#include<bits/stdc++.h>
#define int long long
using namespace std;
int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
const int MAXN=100+10;
int T,a,b,c,ans,p;
int f[MAXN*2][MAXN*2];
bool pd(int x,int y)
{
	if(x+y<-2*c+1||x+y>2*c-1)return 1;
	if(x<-2*a+1||x>2*a-1)return 1;
	if(y<-2*b+1||y>2*b-1)return 1;
	return 0;
}
void dfs(int x,int y,int sum)
{
	if(x==2*a&&y==-2*b)
	{
		if(ans<sum)
		{
			ans=sum;
			p=1;		
		}
		else if(ans==sum)p++;
		return ;
	}
	if(x==2*a)
	{
		dfs(-2*a+1,y-1,sum);
		return ;
	}
	if(pd(x,y))
	{
		dfs(x+1,y,sum);
		return ;
	}
	if(f[x-1+MAXN][y+MAXN]+f[x+MAXN][y+1+MAXN]+f[x-1+MAXN][y+1+MAXN]<=3)
	{
		f[x+MAXN][y+MAXN]=100;
		dfs(x+1,y,sum+1);
		f[x+MAXN][y+MAXN]=0;
	}
	f[x+MAXN][y+MAXN]=1;
	dfs(x+1,y,sum);
	return ;
}
signed main()
{
	freopen("geometry.in","r",stdin);freopen("geometry.out","w",stdout);
	T=read();
	while(T--)
	{
		a=read();b=read();c=read();
		if(a==b&&b==c)
		{
			if(a==1)
			{
				puts("3 2");
			}
			else if(a==2)
			{
				puts("13 1");
			}
			else if(a==3)
			{
				puts("31 1"); 
			}
			else if(a==4)
			{
				puts("57 2");
			}
			else if((2*a)%3==1)
			{
				int sum=0,i=a,cnt=2*a;
				for(;cnt+3>4*a+1;i++,cnt+=3)
				sum+=6*i;
				sum+=i*((a*4+1-cnt)*2+1);
				printf("%lld 1\n",sum);
			}
			else if((2*a)%3==2)
			{
				int sum=0,i=a-1,cnt=2*a;
				for(;cnt+3>4*a+1;i++,cnt+=3)
				sum+=6*i;
				sum+=i*((4*a+1-cnt)*2+1);
				printf("%lld 2\n",sum);
			}
		}
		else
		{
			dfs(-2*a+1,2*b-1,0);
		printf("%lld %lld\n",ans,p);
		ans=p=0;
		}
	}
	return 0;
}

