#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
namespace Subtask8
{
	pair<int, int> dp[32768][2][16]; // best, how many
	int evmod = 0;
	int mods[10010], nea[10010];
	inline int GetBit(int x, int y)
	{
		return (x >> (y - 1)) & 1;
	}
	inline bool chkeven(int x)
	{
		return x & evmod;
	}
	inline int popcnt(int x)
	{
		int res = 0;
		while(x)
			res += (x & 1), x >>= 1;
		return res;
	}
	inline void upd(pair<int, int> A, pair<int, int> &B, int x)
	{
		if(!A.second)
			return;
		A.first += x;
		if(B.first < A.first)
			B = A;
		else if(B.first == A.first)
			B.second = (B.second + A.second) % mod;
	}
	inline void Solve(int a, int b, int c) // a <= c
	{
		if(a > b)
			swap(a, b);
		if(b > c)
			swap(b, c);
		if(a > b)
			swap(a, b);
		int m = 4 * a - 1, mx = 1 << m;
		evmod = 0;
		for(int i = 0; i <= m; i += 2)
			evmod |= (1 << i);
		int A = 2 * a - 1, B = 2 * b - 1, C = 2 * c - 1;
		for(int i = -B; i <= B; i++)
		{
			int I = i + B + 1;
			mods[I] = mx - 1;
			if(-C - i > -A)
			{
				int t = -C - i - (-A);
				mods[I] -= ((1 << t) - 1);
			}
			else if(C - i < A)
			{
				int t = C - i + A;
				mods[I] = ((1 << (t + 1)) - 1);
			}
			if(i % 2 == 0)
				mods[I] &= evmod;
		}
//		cout << "QWQ" << endl;
		
//		for(int i = -B; i <= B; i++)
//			cout << "MODS " << i << " = " << mods[i + B + 1] << endl;
		for(int i = 2; i <= m; i++)
			nea[i] = 7 << (i - 2);
		nea[1] = 3;
		for(int i = 0; i < mx; i++)
			dp[i][0][m] = {0, !i};
		for(int i = -B; i <= B; i++)
		{
			int nw = (i + B) & 1 ^ 1, pre = (i + B) & 1;
			for(int j = 0; j < mx; j++)
				dp[j][nw][0] = dp[j][pre][m];
			for(int j = 1; j <= m; j++)
			{
				for(int k = 0; k < mx; k++)
					dp[k][nw][j] = {0, 0};
				for(int k = 0; k < mx; k++)
				{
					if(!dp[k][nw][j - 1].second)
						continue;
//					cout << "DP " << k << " " << i << " " << j - 1 << " = " << dp[k][nw][j - 1].first << ", " << dp[k][nw][j - 1].second << endl;
					upd(dp[k][nw][j - 1], dp[k & (mx - 1 - (1 << (j - 1)))][nw][j], 0);
					if(!GetBit(mods[i + B + 1], j))
						continue;
					if(!(k & nea[j]))
					{
//						cout << k << ", " << i << ", " << j - 1 << " -> " << (k | (1 << (j - 1))) << ", " << i << ", " << j << endl;
						upd(dp[k][nw][j - 1], dp[k | (1 << (j - 1))][nw][j], 1);
					}
				}
			}
		}
		pair<int, int> ans = {0, 0};
		for(int i = 0; i < mx; i++)
			upd(dp[i][1][m], ans, 0);
		printf("%d %d\n", ans.first, ans.second);
	}
}
int main()
{
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
//		if(a <= 4)
//		{
			Subtask8 :: Solve(a, b, c);
//		}
	}
	return 0;
}
