from sys import stdin input = stdin.readline for _ in range(int(input())): N = int(input()) print(1 if N <= 8 and N not in [2, 6] else 2)