#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5e3+5;
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;
}
bool check(int i,int S,int T)
{
	for (int j=l;j<=r;j++) if (T>>(j-l)&1) if (out(j,i)) return 0;
	return 1;
}
vector<int>tr[1<<13];
void ysgs(int m)
{
	for (int S=0;S<(1<<m);S++) tr[S].clear();
	for (int S=0;S<(1<<m);S++)
	if (!(S&(S>>1)))
	for (int all=((1<<m)-1)^S,T=all;;T=(T-1)&all)
	{
		if (!(T&(T>>1))&&!((S&T)||((S>>1)&T))) tr[S].push_back(T);
		if (!T) break;
	}
}
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;
	ysgs(m);
	for (int i=-2*b+1;i<=2*b;i++)
	{
		vector<int>nf(1<<m,-1),ng(1<<m,0);
		for (int S=0;S<(1<<m);S++)
		if (~f[S])
		for (int T:tr[S])
		{
			if (!check(i,S,T))
			{
				if (!T) break;
				continue;
			}
			int tot=f[S]+__builtin_popcount(T);
			if (nf[T]<tot) nf[T]=tot,ng[T]=0;
			if (nf[T]==tot) ng[T]=(ng[T]+g[S])%p;
			if (!T) break;
		}
		f=nf,g=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;
}
