import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### """ def divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def d(n): return len(divisors(n)) from functools import lru_cache @lru_cache(maxsize=None) def solve(n): if n == 1: return 1 if n == 2: return 2 return solve(n-d(n)) for i in range(1,1000): print(i, solve(i)) """ for i in range(ni()): n = ni() if n in [1,3,4,5,7,8]: print(1) else: print(2)