#include <bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x) {
	x = 0;
	char ch = getchar();
	while (!isdigit(ch))
		ch = getchar();
	while (isdigit(ch))
		x = x * 10 + ch - 48, ch = getchar();
}
const int P = 998244353;
inline void add(int &x, int y) {
	(x += y) >= P && (x -= P);
}
inline void sub(int &x, int y) {
	(x -= y) < 0 && (x += P);
}
inline void mul(int &x, int y) {
	x = 1ull * x * y % P;
}
inline int Add(int x, int y) {
	return add(x, y), x;
}
inline int Sub(int x, int y) {
	return sub(x, y), x;
}
inline int Mul(int x, int y) {
	return mul(x, y), x;
}
const int mx = 11, S = (1 << mx) - 1;
pair<int, int> all[222222];
const int dx[] = {0, 0, 1, -1, 1, -1}, dy[] = {1, -1, 0, 0, -1, 1};
inline bool check(int i, int j) {
	for (int k = 0; k < 6; ++k) {
		pair<int, int> cur = {all[i].first + dx[k], all[i].second + dy[k]};
		if (cur == all[j]) return true;
	}
	return false;
}
inline void up(pair<int, int> &x, pair<int, int> y) {
	if (x.second > y.second) return;
	if (x.second < y.second) x = y;
	else add(x.first, y.first);
}
struct node {
	int s;
	pair<int, int> v;
} f[2222], g[2222];
pair<int, int> pot[2222];
int tmp[4444];
void solve() {
	int a, b, c, m = 0;
	read(a), read(b), read(c);
	int la = 2 * a - 1, lb = 2 * b - 1, lc = 2 * c - 1;
	for (int x = -la; x <= la; ++x)
		for (int y = -lb; y <= lb; ++y)
			if (!(x % 2 == 0 && y % 2 == 0) && abs(x + y) <= lc) all[++m] = {y, x};
	sort(all + 1, all + m + 1);
	int c0 = 1;
	f[1] = {0, make_pair(1, 0)};
	memset(pot, -1, sizeof pot);
	for (int i = 1; i <= m; ++i) {
		int c2 = 0, cur = 0;
		for (int j = 1; j <= min(i - 1, mx); ++j)
			if (check(i, i - j)) cur |= 1 << (j - 1);
		for (int o = 1; o <= c0; ++o) {
			int s = f[o].s;
			auto v = f[o].v;
			tmp[++c2] = (s << 1) & S;
			up(pot[(s << 1) & S], v);
			if (!(cur & s)) {
				tmp[++c2] = (s << 1 | 1) & S;
				up(pot[(s << 1 | 1) & S], {v.first, v.second + 1});
			}
		}
		int c1 = 0;
		for (int o = 1; o <= c2; ++o) {
			int s = tmp[o];
			if (~pot[s].first) {
				f[++c1] = {s, pot[s]};
				pot[s] = {-1, -1};
			}
		}
		c0 = c1;
	}
	pair<int, int> ans = {-1, -1};
	for (int i = 1; i <= c0; ++i)
		up(ans, f[i].v);
	printf("%d %d\n", ans.second, ans.first);
}
int main() {
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);
	int t;
	read(t);
	while (t--)
		solve();
	return 0;
}

