#include <fstream>
#include <iostream>
constexpr int kMod = 998244353;
std::ifstream fin("geometry.in");
std::ofstream fout("geometry.out");
long long Ksm(long long a, long long b) {
  long long s = 1LL;
  while (b) {
    if (b & 1) s = s * a % kMod;
    a = a * a % kMod;
    b >>= 1;
  }
  return s;
}
int main(int argc, char const *argv[]) {
  std::cin.rdbuf(fin.rdbuf()), std::cout.rdbuf(fout.rdbuf());
  int T;
  std::cin >> T;
  while (T--) {
    int a, b, c;
    std::cin >> a >> b >> c;
    if (a == 1 && b == 1 && c == 1) {
      std::cout << "3 2\n";
    } else if (a == 2 && b == 2 && c == 2) {
      std::cout << "12 15\n";
    } else if (a == 3 && b == 3 && c == 3) {
      std::cout << "27 128\n";
    } else if (a == b && b == c) {
      long long s = 0, d = 3;
      for (int i = 1; i <= a; i++) s += d, d += 6;
      std::cout << s << ' ';
      int pw = 1, t;
      if (a & 1) {
        t = 6;
        for (int i = 3; i <= a; i += 2) pw += t, t += 6;
      } else {
        t = 3;
        for (int i = 2; i <= a; i += 2) pw += t, t += 6;
      }
      long long ans = Ksm(2, pw);
      if (~a & 1) ans = (ans + kMod - 1) % kMod;
      std::cout << ans << '\n';
    }
  }
  return 0;
}