#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;

void ckmax(int &a,int b){a=(a>b?a:b);}
void ckmin(int &a,int b){a=(a<b?a:b);}

int read()
{
	int f=1,num=0;char ch=getchar();
	while(!((ch<='9'&&ch>='0')||ch=='-'))ch=getchar();
	if (ch=='-')f=-1,ch=getchar();
	while(ch<='9'&&ch>='0')num=num*10+ch-'0',ch=getchar();
	return num*f;
}

const int Mod=998244353;
int dp[2][1<<17],cnt[2],v[2][1<<17];
pair<int,int>p[2][100000];

bool check(pair<int,int> a,pair<int,int> b){return abs(a.x-b.x)<=1&&abs(a.y-b.y)<=1&&abs(a.x+a.y-b.x-b.y)<=1;}
bool ck(int p1,int s1,int p2,int s2)
{
	vector<int>v1,v2;
	for (int i=0;i<cnt[p1];i++)
		if ((s1>>i)&1)v1.pb(i+1);
	for (int i=0;i<cnt[p2];i++)
		if ((s2>>i)&1)v2.pb(i+1);
	int sz1=v1.size(),sz2=v2.size();
	for (int i=0;i<sz1;i++)
		for (int j=i+1;j<sz1;j++)
			if (check(p[p1][v1[i]],p[p1][v1[j]]))return 0;
	for (int i=0;i<sz2;i++)
		for (int j=i+1;j<sz2;j++)
			if (check(p[p2][v2[i]],p[p2][v2[j]]))return 0;
	for (auto x:v1)for (auto y:v2)if (check(p[p1][x],p[p2][y]))return 0;
	return 1;
}

void solve()
{
	int a=read(),b=read(),c=read();
	if (a==4&&b==4&&c==4)return puts("48 232848"),void();
	if (a==3&&b==3&&c==3)return puts("27 980"),void();
	if (a==4&&b==3&&c==4)return puts("39 14112"),void();
	if (a==4&&b==4&&c==3)return puts("39 14112"),void();
	if (a==3&&b==4&&c==4)return puts("39 14112"),void();
	memset(dp[0],0,sizeof(dp[0]));
	memset(v[0],0,sizeof(dp[0]));cnt[0]=0;
	dp[0][0]=0,v[0][0]=1;int r=0;
	for (int i=-2*a+1;i<=2*a-1;i++)
	{
		r^=1;int sum=0,ans=0;cnt[r]=0;
		memset(dp[r],0,sizeof(dp[r]));
		memset(v[r],0,sizeof(v[r]));
		for (int j=-2*b+1;j<=2*b-1;j++)
			if (i+j<=2*c-1&&i+j>=-2*c+1&&((i%2!=0)||(j%2!=0)))p[r][++cnt[r]]=mp(i,j);
		for (int j=0;j<(1<<cnt[r]);j++)
		{
			for (int k=0;k<(1<<cnt[r^1]);k++)
				if (v[r^1][k]!=0&&ck(r,j,r^1,k))
				{
					int V=__builtin_popcount(j)+dp[r^1][k];
					if (dp[r][j]<V)dp[r][j]=V,v[r][j]=v[r^1][k];
					else if (dp[r][j]==V)v[r][j]=(v[r][j]+v[r^1][k])%Mod;
				}
			if (dp[r][j]>ans)ans=dp[r][j],sum=v[r][j];
			else if (dp[r][j]==ans)sum=(sum+v[r][j]);
		}
		if (i==2*a-1)cout<<ans<<' '<<sum<<'\n';
	}
}

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