#include <stdio.h>
#include <string.h>
#include <set>
#include <algorithm>
#include <map>
#define int long long
const int mod=998244353;
inline int read()
{
    int num=0,x=1,c=getchar();
    while(c<48||c>57){if(c=='-')x=-1;c=getchar();}
    while(c>47&&c<58)num=num*10+(c^48),c=getchar();
    return num*x;
}
#define dway way
int  dp[4005][2049],way[4005][2049];
int DP[50][1<<16|3],WAY[50][1<<16|3];
#define B S
signed main()
{
    freopen("geometry.in","r",stdin);
    freopen("geometry.out","w",stdout);
    int T=read();while(T--)
    {
        int a=read(),b=read(),c=read(),d=4*a-1;
        if(a<=3)
        {
            int Ans=0,Mx=0;
            dway[0][0]=1;
            int S=b*2;
            int Q=0xaaaaa;
            for(int i=-b*2+1;i<=b*2-1;i++)
            {
                for(int j=0;j<(1<<d);j++)dway[i+B][j]=dp[i+B][j]=0;
                for(int j=0;j<(1<<d);j++)
                {
                    if(i%2==0&&(j&Q))continue;
                    if(j)
                    {
                        int x,X;
                        for(int t=0;;t++)if(j>>t&1){x=t;break;}
                        for(int t=d;;t--)if(j>>t&1){X=t;break;}
                        x+=i,X+=i;
                        x-=2*a-1;
                        X-=2*a-1;
                        if(x<-2*c+1||X>2*c-1)continue;
                    }
                    if(j&(j<<1))continue;
                    // printf("%d %d\n",i,j);
                    for(int k=0;k<(1<<d);k++)
                    {
                        if((i%2)&&(k&Q))continue;
                        if((j|(j<<1))&k)continue;
                        if(k&(k<<1))continue;
                        if(k&&i!=-b)
                        {
                            int x,X;
                            for(int t=0;;t++)if(k>>t&1){x=t;break;}
                            for(int t=d;;t--)if(k>>t&1){X=t;break;}
                            x+=i-1,X+=i-1;
                            x-=2*a-1;
                            X-=2*a-1;
                            if(x<-2*c+1||X>2*c-1)continue;
                        }
// printf("%d %d %d\n",i,j,k);
                        int nd=dp[i-1+S][k]+__builtin_popcount(j);
                        if(nd>dp[i+S][j])dp[i+S][j]=nd,dway[i+S][j]=0;
                        if(nd==dp[i+S][j])dway[i+S][j]=(dway[i+S][j]+dway[i-1+S][k])%998244353;
                        Ans=std::max(Ans,nd);
                    }
                }
            }
            int ss=0;
            for(int j=0;j<(1<<d);j++)
                if(dp[b*2-1+B][j]==Ans)
                    ss=(ss+way[b*2-1+B][j])%mod;
            
            printf("%lld %lld\n",Ans,ss);
        }
        else if(a==4)
        {
            #define dp DP
            #undef dway
            #define dway WAY
            #define way WAY
            int Ans=0,Mx=0;
            dway[0][0]=1;
            int S=b*2;
            int Q=0xaaaaa;
            for(int i=-b*2+1;i<=b*2-1;i++)
            {
                for(int j=0;j<(1<<d);j++)dway[i+B][j]=dp[i+B][j]=0;
                for(int j=0;j<(1<<d);j++)
                {
                    if(i%2==0&&(j&Q))continue;
                    if(j)
                    {
                        int x,X;
                        for(int t=0;;t++)if(j>>t&1){x=t;break;}
                        for(int t=d;;t--)if(j>>t&1){X=t;break;}
                        x+=i,X+=i;
                        x-=2*a-1;
                        X-=2*a-1;
                        if(x<-2*c+1||X>2*c-1)continue;
                    }
                    if(j&(j<<1))continue;
                    // printf("%d %d\n",i,j);
                    for(int k=0;k<(1<<d);k++)
                    {
                        if((i%2)&&(k&Q))continue;
                        if((j|(j<<1))&k)continue;
                        if(k&(k<<1))continue;
                        if(k&&i!=-b)
                        {
                            int x,X;
                            for(int t=0;;t++)if(k>>t&1){x=t;break;}
                            for(int t=d;;t--)if(k>>t&1){X=t;break;}
                            x+=i-1,X+=i-1;
                            x-=2*a-1;
                            X-=2*a-1;
                            if(x<-2*c+1||X>2*c-1)continue;
                        }
// printf("%d %d %d\n",i,j,k);
                        int nd=dp[i-1+S][k]+__builtin_popcount(j);
                        if(nd>dp[i+S][j])dp[i+S][j]=nd,dway[i+S][j]=0;
                        if(nd==dp[i+S][j])dway[i+S][j]=(dway[i+S][j]+dway[i-1+S][k])%998244353;
                        Ans=std::max(Ans,nd);
                    }
                }
            }
            int ss=0;
            for(int j=0;j<(1<<d);j++)
                if(dp[b*2-1+B][j]==Ans)
                    ss=(ss+way[b*2-1+B][j])%mod;
            
            printf("%lld %lld\n",Ans,ss);
        }
    }
}