t = int(input()) for _ in range(t): n = int(input()) if n == 1 or 3 <= n <= 5 or n == 8: print(1) else: print(2)