l = [0,1,2,1,1,1,2,1,1,2,2,2,2,2,] T = int(input()) for _ in range(T): N = int(input()) if N >= 10: print(2) else: print(l[N])