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

const int p = 998244353;
int qpow2(int k) {
    int ans = 1, a = 2;
    while (k) {
        if (k & 1) ans = 1LL * ans * a % p;
        a = 1LL * a * a % p;
        k >>= 1;
    }
    return ans;
}

int main() {
    freopen("geometry.in", "r", stdin);
    freopen("geometry.out", "w", stdout);

    int T; scanf("%d", &T);
    while (T--) {
        int a, b, c; scanf("%d%d%d", &a, &b, &c);
        if (a == b && b == c) {
            int x = 2, sx = 2;
            for (int i = 2; i <= a; i++) {
                x = (sx + sx) % p;
                if (i % 2 == 0) x++;
                sx = (sx + x) % p;
            }
            printf("%lld %d\n", 3LL * a * a, x);
            continue;
        }
        if (a == 1) {
            if (b == c) printf("%lld %d\n", 4 * b - 1, 2 * b);
            else {
                int bc = min(b, c);
                printf("%lld %d\n", 4 * b, 1);
            }
            continue;
        }
    }
}