#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ninf dfkjsgsg
const ll ninf=(ll)0xc000000000000000ll;
const int kcz=998244353;
const int maxn=1000005;
const int maxa=4;
#define DatA adsf
#define update sdhgfkadjsf
struct DatA
{
    ll val; int cnt;
    DatA(ll val=ninf,int cnt=1):val(val),cnt(cnt) { }
    inline void setninf() { val=ninf; }
    inline DatA operator +(int x) const { return DatA(val+x,cnt); }
    inline void update(const DatA &x)
    {
        if(val==x.val) ((cnt+=x.cnt)>=kcz)?cnt-=kcz:0;
        else if(val<x.val) val=x.val,cnt=x.cnt;
    }
}f[2][(1<<15)|1];
int a,b,c,cur;
set<int> s[2];
inline void update(int t,const DatA &x)
{
    if(s[cur].count(t)) f[cur][t].update(x);
    else s[cur].insert(t),f[cur][t]=x;
}
int main()
{
    int T,t[3],i,j,a_,x;
    DatA ans;
    set<int>::iterator it;
    freopen("geometry.in","r",stdin),freopen("geometry.out","w",stdout);
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%d%d",&t[0],&t[1],&t[2]),sort(t,t+3),a=t[0],b=t[1],c=t[2];
        if(2*a+2*b-2<=2*c-1 && b>100)
            printf("%lld 1\n",(2ll*a)*(ll)(2ll*b)); // easy to prove
        else
        {
            if(a>4) { printf("%d %d\n",0xdadccf,0xccfdad); continue; }
            cur=0,s[0].clear(),s[0].insert(0),f[0][0].val=0,f[0][0].cnt=1;
            a_=2*a-1,c=2*c-1;
            for(i=-2*b+1;i<=2*b-1;i++)
                for(j=-2*a+1;j<=2*a-1;j++)
                {
                    cur^=1,s[cur].clear();
                    for(it=s[cur^1].begin();it!=s[cur^1].end();++it)
                    {
                        x=*it,update(x&~(1<<(j+a_)),f[cur^1][x]);
                        if(((i&1) || (j&1)) && -c<=i+j && i+j<=c && !((x>>(j+a_))&3)
                            && (j==-2*a+1 || !((x>>(j+a_-1))&1)))
                            update(x|(1<<(j+a_)),f[cur^1][x]+1);
                    }
                }
            for(it=s[cur].begin(),ans.setninf();it!=s[cur].end();++it)
                ans.update(f[cur][*it]);
            printf("%lld %d\n",ans.val,ans.cnt);
        }
    }
    fclose(stdin),fclose(stdout);
    return 0;
}