for _ in range(int(input())): N = int(input()) print(1 + (N == 2 or N == 6 or N > 8))