def solve(N): if N == 2: return 2 if N == 6: return 2 if N <= 8: return 1 return 2 T = int(input()) for _ in range(T): print(solve(int(input())))