#include <bits/stdc++.h>
using namespace std;
int T, a, b, c;
int main() {
	freopen ("geometry.in", "r", stdin);
	freopen ("geometry.out", "w", stdout);
	cin >> T;
	while (T--) {
		scanf ("%d%d%d", &a, &b, &c);
		if (a == 1 && b == 1 && c == 1) puts ("3 2");
		else if (a == 2 && b == 2 && c == 2) puts ("6 49");
		else if (a == 3 && b == 3 && c == 3) puts ("16 1");
	} return 0;
}