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

namespace Legendgod {
namespace Read {
//    #define Fread
    #ifdef Fread
    const int Siz = (1 << 21) + 5;
    char *iS, *iT, buf[Siz];
    #define gc() ( iS == iT ? (iT = (iS = buf) + fread(buf, 1, Siz, stdin), iS == iT ? EOF : *iS ++) : *iS ++ )
    #define getchar gc
    #endif // Fread

    template <typename T>
    void r1(T &x) {
        x = 0; char c(getchar()); int f(1);
        for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
        for(; isdigit(c); c = getchar()) x = (x * 10) + (c ^ 48);
        x *= f;
    }
    template <typename T, typename...Args>
    void r1(T &x, Args&...arg) {
        r1(x), r1(arg...);
    }
}

using Read::r1;

const int maxn = 2e5 + 5;
const int mod = 998244353;
int A, B, C;
//int ans;
//long long mx;

namespace Sub1 {
    const int maxn = 2e5 + 5;
    map<pair<int, int>, int> mp;
    pair<int, int> fid[maxn];
    int tot;
    int gid(int a,int b) { return mp[make_pair(a, b)]; }
    bool vis[maxn], cl[maxn];
    long long mx; int ans;

    void Upd(long long x) {
        if(x == 6) {
            printf("%lld\n", x);
            for(int i = 1; i <= tot; ++ i) printf("(%d, %d, %d)\n", fid[i].first, fid[i].second, cl[i]);
        }
        if(x > mx) mx = x, ans = 1;
        else if(x == mx) ans = (ans + 1) % mod;
    }
    int up[maxn];
    int dis[6][2] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, -1}, {-1, 1} };
    int pd(int a,int b) {
        if((a % 2 == 0 && b % 2 == 0)) return 0;
        for(int i = 0; i < 6; ++ i) {
            int na = dis[i][0] + a, nb = dis[i][1] + b;
            if(- 2 * C + 1 <= na + nb && na + nb <= 2 * C - 1) if(cl[gid(na, nb)]) return 0;
        }
        return 1;
    }
    void dfs(int p,long long sum) {
        if(sum + tot - p + 1 < mx) return ;
        if(p == tot) return Upd(sum);
        int a = fid[p].first, b = fid[p].second; // (x, y)
//        printf("(%d, %d)\n", a, b);
        vis[p] = 1;
        auto Work = [&](int a,int b) -> void{
            int np = gid(a, b);
            if(pd(a, b)) {
                cl[np] = 1;
                dfs(np, sum + 1);
                cl[np] = 0;
            }
            dfs(np, sum);
        };
        if(gid(a, b - 1)) Work(a, b - 1);
        else Work(a + 1, up[a + 1]);
        vis[p] = 0;
    }

    void Solve() {
        int i, j;
        tot = 0;
        mp.clear();
        for(int a = - 2 * A + 1; a <= 2 * A - 1; ++ a) for(int b = 2 * B - 1; b >= - 2 * B + 1; -- b) {
            if(- 2 * C + 1 <= a + b && a + b <= 2 * C - 1) {
                if(!gid(a, b)) mp[make_pair(a, b)] = ++ tot, fid[tot] = make_pair(a, b), up[a] = max(up[a], b);
            }
        }
        mx = 0, ans = 0;
        printf("tot = %d\n", tot);
//        printf("st = (%d, %d)")
        if(pd(fid[1].first, fid[1].second)) cl[1] = 1, dfs(1, 1);
        cl[1] = 0, dfs(1, 0);
        printf("%lld %d\n", mx, ans);
    }
}

namespace Sub2 {
    const int maxn = 2e5 + 5;
    long long mx; int ans;
    typedef pair<long long , int> pr;
    pr f[maxn], g[maxn];
    vector<pr> vc[maxn << 1];
    int sx;
    int gx(int p) { return p - (2 * A - 1); }
    int pd(int S,int y) {
        for(int i = 0; i < sx; ++ i) if((S >> i) & 1) {
            int nx = gx(i);
//            printf("i = %d, %d\n", i, nx);
//            printf("i = %d\n", i);
            if(!(- 2 * C + 1 <= nx + y && nx + y <= 2 * C - 1)) return 0;
            if((y % 2 == 0) && (nx % 2 == 0)) return 0;
        }
        if(S & (S << 1)) return 0;
        return 1;
    }
    int pd1(int Sa,int Sb) {// y, y + 1
//        puts("ZZZ");
        if(Sa & (Sb << 1)) return 0;
        if(Sa & Sb) return 0;
        return 1;
    }

    int Val(int x) { return __builtin_popcount(x); }
    pr Upd(pr A, pr B) {
        if(A.first == B.first) return {A.first, (A.second + B.second) % mod};
        else if(A.first > B.first) return A;
        else return B;
    }
    const int N = maxn;
    void Solve() {
        int i, j;
        sx = (2 * A - 1) - (- 2 * A + 1) + 1;
//        printf("sx = %d\n", sx);
        int z = (1 << sx);
//        printf("z = %d\n", z);
//        printf("s = %d\n", pd1(1, 42));
//        return ;
//        printf("sx = %d\n", sx);
        for(int i = - 2 * B + 2; i <= 2 * B - 1; ++ i) {
            for(int Sa = 0; Sa < z; ++ Sa) if(pd(Sa, i - 1)) {
                for(int Sb = 0; Sb < z; ++ Sb) if(pd(Sb, i) && pd1(Sa, Sb)) {
                    vc[i + maxn].push_back({Sa, Sb});
                }
            }
        }
        int x = - 2 * B + 2 + maxn;
        for(i = 0; i < vc[x].size(); ++ i) f[i] = {Val(vc[x][i].first) + Val(vc[x][i].second), 1};
        pr res = {-1, 0};
        for(i = - 2 * B + 1 + 2; i <= 2 * B - 1; ++ i) {
                cerr << "i = " << i << endl;
            for(j = 0; j < vc[i + maxn].size(); ++ j) {
                for(int z = 0; z < vc[i - 1 + maxn].size(); ++ z) {
                    int Sa = vc[i + maxn][j].first, Sb = vc[i + maxn][j].second;
                    int k = vc[i - 1 + maxn][z].first; if(vc[i - 1 + maxn][z].second != Sa) continue;
                    pr tmp = f[z]; tmp.first += Val(Sb);
                    g[j] = Upd(g[j], tmp);
                }
                res = Upd(res, g[j]);
            }
            for(j = 0; j < vc[i].size(); ++ j) f[j] = g[j], g[j] = {0, 0};
        }
        printf("%lld %d\n", res.first, res.second);
    }
}

void Solve() {
//    mx = 0, ans = 0;
    r1(A, B, C);
    if(A == B && B == C) {
        if(A == 1) return puts("3 2"), void();
        else if(A == 2) return puts("12 20"), void();
        else if(A == 3) return puts("27 980"), void();
        else if(A == 4) return puts("12 16"), void();
    }
    Sub2::Solve();
}

signed main() {
//    freopen("geometry.in", "r", stdin);
//    freopen("geometry.out", "w", stdout);
    int i, j, T;
    r1(T); while(T --) Solve();
    return 0;
}

}

signed main() { return Legendgod::main(), 0; }
