#include<bits/stdc++.h>
using namespace std;

#define Mod(x) (x>=P)&&(x-=P)
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define erep(i,a) for(int i=hd[a],y;y=to[i],i;i=nxt[i])

typedef long long ll;
void Max(int &x,int y){x<y&&(x=y);}
void Min(int &x,int y){x>y&&(x=y);}

bool f1;
char IO;
int rd(int res=0){
	bool f=0;
	while(IO=getchar(),IO<48||IO>57)
		f|=IO=='-';
	do res=(res<<1)+(res<<3)+(IO^48);
	while(isdigit(IO=getchar()));
	return f?-res:res;
}

const int P=998244353;
int a,b,c;
namespace P40{
	int dp[2][33000][10];
	void Add(int &x,int y){x+=y,Mod(x);}
	void solve(){
		int S=(1<<(4*a-1))-1;
		memset(dp,0,sizeof dp);
		dp[0][0][0]=1;
		int T=2;
		int cur=1,Mx=0,bas=0;
		int Lm=-2*c+1+2*a-1+2*b-1;
		int Rm=2*c-1+2*a-1+2*b-1;
		rep(i,0,4*b-2){
			rep(j,0,4*a-2){
				rep(s,0,S)rep(k,0,T+1)dp[cur][s][k]=0;
				rep(s,0,S)rep(k,0,T)
					Add(dp[cur][s&(S^1<<j)][k],dp[!cur][s][k]);
				if(i+j<Lm||i+j>Rm){
					cur^=1;
					continue;
				}
				if((i&1)&&(j&1)){
					cur^=1;
					continue;
				}
				rep(s,0,S){
					if(1<<j&s||1<<(j+1)&s)continue;
					if(j&&1<<(j-1)&s)continue;
					rep(k,0,T){
						if(!dp[!cur][s][k])continue;
						Add(dp[cur][s|1<<j][k+1],dp[!cur][s][k]);
						Max(Mx,bas+k+1);
					}
				}
				if(bas+T<Mx){
					rep(k,0,T)rep(s,0,S)
						dp[cur][s][k]=dp[cur][s][k+1];
					bas++;
				}
				cur^=1;
			}
		}
		cur^=1;
		int res=0;
		rep(s,0,S)Add(res,dp[cur][s][Mx-bas]);
		printf("%d %d\n",Mx,res);
	}
}
bool f2;
int main(){
	cerr<<(&f1-&f2)/1024.0/1024<<endl;
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	rep(cas,1,rd()){
		a=rd(),b=rd(),c=rd();
		if(a<=4)P40::solve();
	}
	return 0;
}
