import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 memo = {} def solve(): n = ii() i2 = pow(2, mod - 2, mod) i43 = 3 * pow(4, mod - 2, mod) i43 %= mod ans = 1 #0は0 ans += (n - 1) * i2 ans %= mod #ある頂点への最短距離が2である→直接の辺は逆向きであり,かつある頂点vであって,0→v→1という経路がある if n >= 2: cnt = i2 * (1 - pow(i43, n - 2, mod)) ans += (n - 1) * cnt ans %= mod ans *= pow(2, n * (n - 1) // 2, mod) ans %= mod print(ans) for _ in range(ii()): solve()