#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int mod = 998244353;
int add(int x, int y) {return x + y >= mod ? x + y - mod : x + y;}
void inc(int &x, int y) {x = add(x, y);}
int a, b, c, dp[2][1 << 15][2];
vector <int> can[1 << 15];
vector <int> sta;
void func() {
	scanf("%d%d%d", &a, &b, &c);
	a = 2 * a - 1, b = 2 * b - 1, c = 2 * c - 1;
	int n = 2 * a + 1, m = 2 * b + 1;
	sta.clear(); for (int S = 0; S < (1 << n); S++) can[S].clear();
//	cerr << clock() << endl;
	for (int S = 0; S < (1 << n); S++) {
		bool ok = 0;
		for (int j = 0; j < n - 1; j++) {
			if ((S >> j & 1) && (S >> (j + 1) & 1)) {
				ok = 1;
				break;
			}
		}
		if (!ok) sta.pb(S);
	}
	for (auto S : sta) {
		for (auto T : sta) {
			bool ok = 0;
			for (int i = 0; i < n; i++)
				if ((S >> i & 1) && ((T >> i & 1) || (i && (T >> (i - 1) & 1)))) {ok = 1; break;}
			if (!ok) can[S].pb(T);
		}
	}
//	cerr << clock() << endl;
	for (auto S : sta) dp[1][S][0] = -1, dp[1][S][1] = 0;
	dp[1][0][0] = 0, dp[1][0][1] = 1;
	for (int i = 0; i < m; i++) {
		int cur = i & 1;
		for (auto S : sta) dp[cur][S][0] = -1, dp[cur][S][1] = 0;
		for (auto S : sta) if (dp[cur ^ 1][S][0] != -1) {
			for (auto T : can[S]) {
				bool ok = 0;
				for (int j = 0; j < n; j++)
					if ((T >> j & 1) && ((i - b) % 2 == 0 && (j - a) % 2 == 0 || i - b + j - a < -c || i - b + j - a > c)) {ok = 1; break;}
				if (ok) continue; int now = __builtin_popcount(T);
				if (dp[cur ^ 1][S][0] + now > dp[cur][T][0]) {
					dp[cur][T][0] = dp[cur ^ 1][S][0] + now;
					dp[cur][T][1] = dp[cur ^ 1][S][1];
				} else if (dp[cur ^ 1][S][0] + now == dp[cur][T][0]) {
					inc(dp[cur][T][1], dp[cur ^ 1][S][1]);
				}
			}
		}
	}
	int ans1 = -1, ans2 = 0;
	for (auto S : sta)
		if (dp[m - 1 & 1][S][0] > ans1) {
			ans1 = dp[m - 1 & 1][S][0], ans2 = dp[m - 1 & 1][S][1];
		} else if (dp[m - 1 & 1][S][0] == ans1) {
			inc(ans2, dp[m - 1 & 1][S][1]);
		}
	printf("%d %d\n", ans1, ans2);
}

int main() {
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);
	int t; scanf("%d", &t);
	while (t--) func();
	return 0;
}
