#include<bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define siz(x) ((int)x.size())
#define fil(a,b) memset(a,b,sizeof a)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
	ll x=0,f=1;char c=getchar();
	while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if (c=='-') f=-1,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}

const int N = 1<<11|10, mod = 998244353, inf = 1e9;
pa f[N],g[N];
int tot[N],v[N][N];
bool ck[N];
inline int cnt(int x){
	return __builtin_popcount(x);
}
inline int Mod(int x){
	return x>=mod?x-mod:x;
}
inline void upd(pa &x,pa y){
	if (y.fi>x.fi) x=y;
	else if (y.fi==x.fi) x.se=Mod(x.se+y.se);
}
inline void solve(){
	int a=read(),b=read(),c=read();
	For(j,0,(1<<(4*a-1))-1){
		bool fl=0;
		For(k,1,4*a-2) if (j>>k&1){
			if (j>>(k-1)&1) fl=1;
		}
		ck[j]=fl;
	}
	For(j,0,(1<<(4*a-1))-1){
		tot[j]=0;
		for (int k=j;;k=(k-1)&j){
			if (!ck[k]) v[j][++tot[j]]=k;
			if (k==0) break;
		}
	}
	bool flag=0;
	For(i,-2*b+1,2*b-1){
		int l=inf,r=-inf;
		For(j,-2*a+1,2*a-1){
			if (i%2==0&&j%2==0) continue;
			if (i+j>=-2*c+1&&i+j<=2*c-1){
				if (l==inf) l=j;
				r=j;
			}
		}
		if (l>r) continue;
		if (!flag){
			For(j,0,(1<<(4*a-1))-1){
				bool fl=ck[j];
				For(k,0,4*a-2) if (j>>k&1){
					if (i+(-2*a+1+k)<-2*c+1) fl=1;
					if (i+(-2*a+1+k)>2*c-1) fl=1;
					if (i%2==0&&k%2==1) fl=1;
				}
				if (fl){
					f[j]=mp(0,0);
					continue;
				}
			//	For(k,0,4*a-2) printf("%d ",j>>k&1);
			//	puts("");
				f[j]=mp(cnt(j),1);
			}
			flag=1;
			continue;
		}
		int mask=(1<<(4*a-1))-1;
		if (i%2==0){
			For(k,0,4*a-2) if (k%2==1) mask^=1<<k;
		}
		For(k,0,4*a-2) if (i+(-2*a+1+k)<-2*c+1||i+(-2*a+1+k)>2*c-1){
			if (mask>>k&1) mask^=1<<k;
		}
		For(j,0,(1<<(4*a-1))-1) if (f[j].se){
			int p=mask;
			For(k,0,4*a-2) if (j>>k&1){
				if (p>>k&1) p^=1<<k;
				if (k&&(p>>(k-1)&1)) p^=(1<<(k-1)); 
			}
			/*if (i==1){
				For(k,0,4*a-2) printf("%d",p>>k&1);
				puts("");
				For(k,0,4*a-2) printf("%d",j>>k&1);
				puts("\n");
			}*/
			/*for (int l=p;;l=(l-1)&p){
				if (!ck[l]) upd(g[l],f[j]);
				if (l==0) break;
			}*/
			For(l,1,tot[p]) upd(g[v[p][l]],f[j]);
		}
		For(j,0,(1<<(4*a-1))-1) g[j].fi+=cnt(j);
		For(j,0,(1<<(4*a-1))-1) f[j]=g[j],g[j]=mp(0,0);
	}
	pa ans=mp(0,1);
	FOR(i,0,1<<(4*a-1)) upd(ans,f[i]);
	printf("%d %d\n",ans.fi,ans.se);
}

int main(){
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	int T=read();
	while (T--) solve();
}
/*
4
2 1 2
1 1 137
3 94 95
3 1998 1996
*/
