#include<bits/stdc++.h>
#define p 998244353
#define ll long long
using namespace std;
int dr()
{
	int xx=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')xx=xx*10+ch-'0',ch=getchar();
	return xx*f;
}
/*ll cal0(int a,int b,int c)
{
	if(a==0)return 0;
	if(a+b<=c)return 1ll*a*b;
	return 2*(a+b+c)-3+cal0(a-1,b-1,c-1);
}
int cal1(int a,int b,int c)
{
	if(a<=3)
	{
		
	}
	return 0;
}*/
int T,a,b,c,m,zm;
int zt[1<<15],zn;
void ss(int t,int tt=0)
{
	if(t>=m)
	{
		zt[zn++]=tt;
		return;
	}
	ss(t+1,tt),ss(t+2,tt|(1<<t));
}
ll f[1<<15],g[1<<15],ans0;int fn[1<<15],gn[1<<15],ans1;
void work(int i,int x,int op)
{
	ll fa=f[i]+op;int ff=fn[i];
	int li=(i&(zm-1-(1<<x)))|(op<<x);
	if(fa>g[li])g[li]=fa,gn[li]=ff;
	else if(fa==g[li])gn[li]+=ff,gn[li]-=gn[li]>=p?p:0;
}
int main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	T=dr();
	while(T--)
	{
		a=dr(),b=dr(),c=dr();
		if(a>b)swap(a,b);if(b>c)swap(b,c);if(a>b)swap(a,b);
		if(a<=4)
		{
			m=2*(2*a-1)+2,zm=1<<m,zn=0;
			ss(0);
			memset(f,0,sizeof(ll)*zm),memset(fn,0,sizeof(int)*zm);
			fn[0]=1;
			for(int y=2*b-1;y>=-2*b+1;y--)
			{
				for(int x=-2*a+1;x<=2*a-1;x++)
				{
					for(int li=0;li<zn;li++)g[zt[li]]=gn[zt[li]]=0;
					int lx=x+2*a-1;
					for(int li=0;li<zn;li++)
					{
						int i=zt[li];
						work(i,lx,0);
						if((x+y<=2*c-1&&x+y>=-2*c+1)&&(x%2!=0||y%2!=0)&&(lx==0||(i&(1<<(lx-1)))==0)&&(i&(1<<lx))==0&&(lx==m||(i&(1<<(lx+1)))==0))work(i,lx,1);
					}
					for(int li=0;li<zn;li++)f[zt[li]]=g[zt[li]],fn[zt[li]]=gn[zt[li]];
				}
				for(int li=0;li<zn;li++)g[zt[li]]=gn[zt[li]]=0;
				for(int i=0;i<zm;i++)
				{
					int li=(i&((1<<(m-1))-1))<<1;
					if(f[i]>g[li])g[li]=f[i],gn[li]=fn[i];
					else if(f[i]==g[li])gn[li]+=fn[i],gn[li]-=gn[li]>=p?p:0;
				}
				for(int li=0;li<zn;li++)f[zt[li]]=g[zt[li]],fn[zt[li]]=gn[zt[li]];
			}
			ans0=ans1=0;
			for(int li=0;li<zn;li++)
			{
				int i=zt[li];
				if(f[i]>ans0)ans0=f[i],ans1=fn[i];
				else if(f[i]==ans0)ans1+=fn[i],ans1-=ans1>=p?p:0;
			}
			printf("%lld %d\n",ans0,ans1);
		}
		//printf("%lld %d\n",cal0(a,b,c),cal(a,b,c));
	}
}
