#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pc putchar
#define chkmx(a,b) (a)=max((a),(b))
#define chkmn(a,b) (a)=min((a),(b))
#define lowbit(x) ((x)&-(x))
using namespace std;
template<class T>void read(T&x){x=0;char c=getchar();bool f=false;for(;!isdigit(c);c=getchar())f|=(c=='-');for(;isdigit(c);c=getchar())x=x*10+(c-'0');if(f)x=-x;}
template<class T,class ...Arg>void read(T&x,Arg&...arg){read(x);read(arg...);}
template<class T>void write(T x){if(x<0)pc('-'),x=-x;if(x>=10)write(x/10);pc(x%10+'0');}
template<class T,class ...Arg>void write(T x,Arg ...arg){write(x);pc(' ');write(arg...);}
template<class ...Arg>void writeln(Arg ...arg){write(arg...);pc('\n');}
const int mod=998244353;
struct mint{
	int x;
	mint(int o=0){x=o%mod;}
	mint&operator+=(mint b){return x+=b.x,(x>=mod&&(x-=mod)),*this;}
	mint&operator-=(mint b){return x-=b.x,(x<0&&(x+=mod)),*this;}
	mint&operator*=(mint b){return(x=1ll*x*b.x%mod),*this;}
	mint&operator^=( int b){mint a=*this;x=1;while(b)(b&1)&&(*this*=a,1),a*=a,b>>=1;return*this;}
	mint&operator/=(mint b){return*this*=(b^=mod-2);}
	friend mint operator+(mint a,mint b){return a+=b;}
	friend mint operator-(mint a,mint b){return a-=b;}
	friend mint operator*(mint a,mint b){return a*=b;}
	friend mint operator^(mint a, int b){return a^=b;}
	friend mint operator/(mint a,mint b){return a/=b;}
	mint operator-(){return 0-*this;}
};
struct node{
	int mx;mint cnt;
	node(int mx=0,mint cnt=0):mx(mx),cnt(cnt){}
	node&operator+=(node rhs){
		if(rhs.mx>mx)mx=rhs.mx,cnt=0;
		if(rhs.mx==mx)cnt+=rhs.cnt;
		return*this;
	}
};
int T,a,b,c;
namespace solve0{
	//解决 a<=3 的情况，奇数层有 11 个点，偶数层有 6 个点
	//然后枚举转移的时候先枚举上一层的状态，再枚举这一层的状态
	//之一层的状态只能是这一层可选的集合和上一层的补集的交的子集
	node dp[2][1<<11];
	const int full=(1<<11)-1;
	vector<int>st;//每层可行的状态
	vector<short>subset[1<<11];
	void init(){
		for(int i=0;i<(1<<11);i++)
			for(int j=i;;j=(j-1)&i){
				if(!(j&(j>>1)))subset[i].pb(j);
				if(j==0)break;
			}
	}
	void work(){
		st.clear();
		st.pb(0);
		for(int i=-2*b+1;i<=2*b-1;i++){
			int now=0;
			for(int j=-2*a+1;j<=2*a-1;j++)
				if(!(i%2==0&&j%2==0)&&-2*c+1<=i+j&&i+j<=2*c-1)
					now|=1<<(j+2*a-1);
			st.pb(now);
		}
		int cur=0,lst=1;
		for(int i=0;i<(1<<11);i++)dp[cur][i]=node(-0x3f3f3f3f,0);
		dp[cur][0]=node(0,1);
		for(int i=0;i+1<(int)st.size();i++){
			swap(cur,lst);
			for(int i=0;i<(1<<11);i++)dp[cur][i]=node(-0x3f3f3f3f,0);
			for(int S=st[i];;S=(S-1)&st[i]){
				if(dp[lst][S].mx>=0){
					int can=(full^(S|(S>>1)))&st[i+1];
					for(int T:subset[can])
						dp[cur][T]+=dp[lst][S];
				}
				if(S==0)break;
			}
			for(int S:subset[st[i+1]])dp[cur][S].mx+=__builtin_popcount(S);
		}
		node ans(-0x3f3f3f3f,0);
		for(int i=0;i<(1<<11);i++)ans+=dp[cur][i];
		writeln(ans.mx,ans.cnt.x);
	} 
}
namespace solve1{
	//a<=4,b,c<=4的情况
	//现在一层有 15 个点
	//暴力真的完吗
	node dp[2][1<<15];
	const int full=(1<<15)-1;
	vector<int>st;//每层可行的状态
	void work(){
		st.clear();
		st.pb(0);
		for(int i=-2*b+1;i<=2*b-1;i++){
			int now=0;
			for(int j=-2*a+1;j<=2*a-1;j++)
				if(!(i%2==0&&j%2==0)&&-2*c+1<=i+j&&i+j<=2*c-1)
					now|=1<<(j+2*a-1);
			st.pb(now);
		}
		int cur=0,lst=1;
		for(int i=0;i<(1<<15);i++)dp[cur][i]=node(-0x3f3f3f3f,0);
		dp[cur][0]=node(0,1);
		for(int i=0;i+1<(int)st.size();i++){
			swap(cur,lst);
			for(int i=0;i<(1<<15);i++)dp[cur][i]=node(-0x3f3f3f3f,0);
			for(int S=st[i];;S=(S-1)&st[i]){
				if(dp[lst][S].mx>=0){
					int can=(full^(S|(S>>1)))&st[i+1];
					for(int T=can;;T=(T-1)&can){
						dp[cur][T]+=dp[lst][S];
						if(T==0)break;
					}
				}
				if(S==0)break;
			}
			for(int S=st[i+1];;S=(S-1)&st[i+1]){
				dp[cur][S].mx+=__builtin_popcount(S);
				if(S==0)break;
			}
		}
		node ans(-0x3f3f3f3f,0);
		for(int i=0;i<(1<<15);i++)ans+=dp[cur][i];
		writeln(ans.mx,ans.cnt.x);
	} 
}
signed main(){
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	solve0::init();
	read(T);
	while(T--){
		read(a,b,c);
		if(a<=3&&b<=5e3&&c<=5e3)solve0::work();
		else if(a<=4&&b<=4&&c<=4)solve1::work();
	}
	//cerr<<1.*clock()/CLOCKS_PER_SEC<<endl;
	return 0;
}
