#int(input()) #map(int, input().split()) #list(map(int, input().split())) from collections import Counter def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a T = int(input()) x = [0] * T for i in range(T): x[i] = int(input()) a = [1, 3, 4, 5, 7, 8] for i in range(T): if x[i] in a: print("1") else: print("2")