#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
const int N=1000010;
typedef long long ll;
namespace brute{
	const int N=21;
	int id[N*2][N*2],tt;
	vector<int>g[N*N];
	int ans,res,col[N*N],deg[N*N];
	void dfs(int u,int c)
	{
		if(u>tt)
		{
			if(c>ans) ans=c;
			if(c==ans) ++res;
			return;
		}
		if(tt-u+1+c<ans) return;
		int w=1,hv=1;
		for(int v:g[u])
			if(v<u && col[v]){hv=0;break;}
		if(hv) col[u]=1,dfs(u+1,c+1),deg[u]=0;
		else deg[u]=1;
		for(int v:g[u]) if(v<u && !col[v] && --deg[v]==0) w=0;
		else if(v>u) deg[u]++;
		if(w && deg[u]) col[u]=0,dfs(u+1,c);
		for(int v:g[u]) if(v<u && !col[v]) ++deg[v]; 
	}
	void solve(int a,int b,int c)
	{
		memset(deg,0,sizeof(deg));
		memset(id,0,sizeof(id));
		a=2*a-1,b=2*b-1,c=2*c-1;
		tt=0;
		for(int i=-a;i<=a;i++)
			for(int j=-b;j<=b;j++)
				if(i+j<=c && i+j>=-c && (i%2!=0 || j%2!=0))
					id[i+N][j+N]=++tt;
		for(int i=-a;i<=a;i++)
			for(int j=-b;j<=b;j++) if(id[i+N][j+N])
			{
				int u=id[i+N][j+N];
				if(id[i+1+N][j+N])
				{
					int v=id[i+1+N][j+N];
					g[u].push_back(v),g[v].push_back(u);
				}
				if(id[i+N][j-1+N])
				{
					int v=id[i+N][j-1+N];
					g[u].push_back(v),g[v].push_back(u);
				}
				if(id[i+1+N][j-1+N])
				{
					int v=id[i+1+N][j-1+N];
					g[u].push_back(v),g[v].push_back(u);
				}
			}
		ans=res=0;
		dfs(1,0);
		printf("%d\n%d\n",ans,res);
		for(int i=1;i<=tt;i++) g[i].clear();
	}
}
int main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	int t;scanf("%d",&t);
	while(t --> 0)
	{
		int a,b,c;scanf("%d%d%d",&a,&b,&c);
		if(a==3 && b==3 && c==3){puts("27\n980");continue;}
		brute::solve(a,b,c);
	}
	return 0;
}
