P = 998244353 power = [0] * 7 power[0] = 3 for i in range(1,7): power[i] = power[i-1] ** 2 power[i] %= P def calc(N): ans = 1 for i in range(7): if N & (1 << i): ans *= power[i] ans %= P return ans T = int(input()) for _ in range(T): N = int(input()) print(calc(N-1) * 2 % P)