#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int T, a, b, c;
int main() {
  freopen("geometry.in", "r", stdin);
  freopen("geometry.out", "w", stdout);
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &a, &b, &c);
    a *= 2;
    if (a % 3 == 1) {
      int ans = 0;
      for (int i = 1; i <= a; i += 3) {
        (ans += 2ll * i % mod) %= mod;
      }
      (ans += 1ll * (a / 3 - 1) * (a + a - 1) % mod) %= mod;
      (ans += a - 1) %= mod;
      printf("%d 1\n", ans);
    } else if (a % 3 == 0) {
      int ans = 0;
      for (int i = 2; i <= a; i += 3) {
        (ans += 2ll * i % mod) %= mod;
      }
      (ans += 1ll * (a / 3 - 1) * (a + a - 1) % mod) %= mod;
      (ans += a) %= mod;
      printf("%d 1\n", ans);
    } else {
      int ans = 0;
      for (int i = 2; i <= a; i += 3) {
        (ans += i + i - 1) %= mod;
      }
      (ans += 1ll * (a / 3) * (a + a - 1) % mod) %= mod;
      printf("%d 2\n", ans);
    }
  }
  return 0;
}
