#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#define rep(i, l, r) for(int i = l, i##end = r; i <= i##end; ++ i)
#define per(i, l, r) for(int i = l, i##end = r; i >= i##end; -- i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pii;
const int N = 5e6 + 15, M = 1e5 + 15, P = 998244353;

int L[N], R[N], bit[M];
int s[M], cnt;
int a, b, c, cl, cr;
pii f[2][M], ans;
bool tmp[N];
vector <int> to[M], fr[M];

inline void madd(ll &x, ll y) {
	x += y;
	if(x >= P) x -= P;
}

inline void upd(pii &x, const pii &y, int z) {
	if(y.fi + z > x.fi) x = mp(y.fi + z, y.se);
	else if(y.fi + z == x.fi) madd(x.se, y.se);
}

inline bool c11(int x) {
	for(; x; x >>= 1)
		if((x & 3) == 3) return 0;
	return 1;
}

inline bool chk(int x, int y) {
	return !(x & y) && !((x >> 1) & y);
}

inline bool cv(int x, int i) {
	rep(j, 0, L[i] - 1)
		if((x >> j) & 1) return 0;
	rep(j, R[i] + 1, a)
		if((x >> j) & 1) return 0;
	if(i & 1) {
		for(; x; x >>= 2)
			if((x & 2) == 2) return 0;
	}
	return 1;
}

inline void init() {
	cnt = 0;
	rep(i, 0, (1 << a + 1) - 1)
		if(c11(i)) s[++ cnt] = i;
	rep(i, 1, cnt) to[i].clear(), fr[i].clear();
	rep(i, 1, cnt) rep(j, 1, cnt)
		if(chk(s[i], s[j])) {
			to[i].pb(j);
			fr[j].pb(i);
		}
	rep(i, 0, b) {
		L[i] = max(0, cl - i);
		R[i] = min(a, cr - i);
	}
}

void solve() {
	scanf("%d%d%d", &a, &b, &c);
	cl = - c * 2 + 1 + 2 * (a + b - 1);
	cr = c * 2 - 1 + 2 * (a + b - 1);
	a = a * 4 - 2; b = b * 4 - 2;
	init();
	ans = mp(0, 0);
	rep(i, 1, cnt) if(cv(s[i], 0)) f[0][i] = mp(bit[s[i]], 1);
	int now = 0;
	rep(i, 1, b) {
		now ^= 1;
		rep(j, 1, cnt) f[now][j] = mp(0, 0);
		if(!(i & 1)) {
			rep(k, 1, cnt) tmp[k] = cv(s[k], i);
			rep(j, 1, cnt) if(cv(s[j], i - 1))
				for(int k : to[j]) if(tmp[k] && chk(s[j], s[k]))
					upd(f[now][k], f[now ^ 1][j], bit[s[k]]);
		} else {
			rep(j, 1, cnt) tmp[j] = cv(s[j], i - 1);
			rep(k, 1, cnt) if(cv(s[k], i))
				for(int j : fr[k]) if(tmp[j] && chk(s[j], s[k]))
					upd(f[now][k], f[now ^ 1][j], bit[s[k]]);
		}
	}
	rep(i, 1, cnt) upd(ans, f[now][i], 0);
	printf("%lld %lld\n", ans.fi, ans.se);
}

int main() {
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);
	int T;
	scanf("%d", &T);
	rep(i, 1, 65536)
		bit[i] = bit[i >> 1] + (i & 1);
	while(T --) solve();
	return 0;
}