#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int p=998244353;

ll read(){static ll x;scanf("%lld",&x);return x;}
void write(ll x){printf("%lld",x);}
void print(ll x,char c='\n'){write(x),putchar(c);}

int a,b,c,l,r,m;
bool out(int x,int y)
{
	if (x%2==0&&y%2==0) return 1;
	return x<=-a*2||a*2<=x||y<=-b*2||b*2<=y||x+y<=-c*2||c*2<=x+y;
}
void work()
{
	a=read(),b=read(),c=read(),l=-2*a+1,r=2*a-1,m=r-l+1;
	vector<int>f(1<<m,-1),g(1<<m,0);
	f[0]=0,g[0]=1;
	for (int i=-2*b+1;i<=2*b;i++)
	for (int j=l;j<=r;j++)
	{
		vector<int>nf(1<<m,-1),ng(1<<m,0);
		for (int S=0;S<(1<<m);S++)
		if (~f[S])
		for (int x=0;x<=!out(j,i);x++)
		{
			if (j>l){if (x&&(S>>(j-l-1)&7)) continue;}
				else{if (x&&(S>>(j-l)&3)) continue;}
			int nS=(S^((S>>(j-l)&1)<<(j-l)))|(x<<(j-l)),tot=f[S]+x;
			if (nf[nS]<tot) nf[nS]=tot,ng[nS]=0;
			if (nf[nS]==tot) (ng[nS]+=g[S])>=p?ng[nS]-=p:0;
		}
		f.swap(nf),g.swap(ng);
	}
	print(f[0],' '),print(g[0]);
}

signed main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	
	int T=read();
	while (T--) work();
	
	return 0;
}
