#include <bits/stdc++.h>   template <unsigned P>   class modint {     static_assert(1 <= P);     using mint = modint<P>;       protected:     unsigned v;       public:     modint() : v() {}     template <typename T, typename std::enable_if<std::is_signed<T>::value &&                                                       std::is_integral<T>::value,                                                   bool>::type = true>     modint(T _v) {       long long tmp = _v % static_cast<long long>(P);       if (tmp < 0) {         tmp += P;       }       v = tmp;     }     template <typename T, typename std::enable_if<std::is_unsigned<T>::value &&                                                       std::is_integral<T>::value,                                                   bool>::type = true>     modint(T _v) {       v = _v % P;     }     unsigned val() const { return v; }     static constexpr unsigned mod() { return P; }     static mint raw(unsigned v) {       mint res;       res.v = v;       return res;     }     mint &operator+=(const mint &rhs) {       v < P - rhs.v ? v += rhs.v : v -= P - rhs.v;       return *this;     }     mint &operator++() {       v + 1 < P ? ++v : v = 0;       return *this;     }     mint operator++(int) {       mint tmp = *this;       v + 1 < P ? ++v : v = 0;       return tmp;     }     mint &operator-=(const mint &rhs) {       v < rhs.v ? v += P - rhs.v : v -= rhs.v;       return *this;     }     mint &operator--() {       v == 0 ? v = P - 1 : --v;       return *this;     }     mint operator--(int) {       mint tmp = *this;       v == 0 ? v = P - 1 : --v;       return tmp;     }     mint operator-() const {       mint res;       res.v = v == 0 ? 0 : P - v;       return res;     }     mint &operator*=(const mint &rhs) {       v = static_cast<unsigned long long>(v) * rhs.v % P;       return *this;     }     mint pow(unsigned long long b) const {       mint a(*this), s(1);       for (; b; b >>= 1) {         if (b & 1) {           s *= a;         }         a *= a;       }       return s;     }     mint inv() const { return pow(P - 2); }     friend mint operator+(const mint &lhs, const mint &rhs) {       return mint(lhs) += rhs;     }     friend mint operator-(const mint &lhs, const mint &rhs) {       return mint(lhs) -= rhs;     }     friend mint operator*(const mint &lhs, const mint &rhs) {       return mint(lhs) *= rhs;     }     friend bool operator==(const mint &lhs, const mint &rhs) {       return lhs.v == rhs.v;     }     friend bool operator!=(const mint &lhs, const mint &rhs) {       return lhs.v != rhs.v;     }     friend std::istream &operator>>(std::istream &in, mint &x) {       return in >> x.v;     }     friend std::ostream &operator<<(std::ostream &out, const mint &x) {       return out << x.v;     }   };   using mint = modint<998244353>;   const mint mi2 = mint(2), minv2 = mi2.inv();   void solve() {     int n, k, x;     std::cin >> n >> k >> x;     if (x == 0) {       if (n > k) {         std::cout << 0 <<   n ;         return;       }       mint pw = mi2.pow(k), now = 1;       mint ans = 1;       for (int i = 0; i < n; ++i) {         ans *= pw - now;         now += now;       }       std::cout << ans <<   n ;       return;     }     mint pw = mi2.pow(k), pwn = pw.pow(n), inv = minv2.pow(n);     mint now = 1;     mint ans = 0;     for (int i = 1; i <= k; ++i) {       pw *= minv2;       pwn *= inv;       ans += pwn * now * pw;       now *= 1 - pw;     }     std::cout << ans <<   n ;   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(nullptr);     int T;     std::cin >> T;     while (T--) {       solve();     }   }