def make_divisors(n): divisors = [] #必要に応じてsetにしても良いかも i = 1 while i ** 2 <= n: if n % i == 0: divisors.append(i) if i ** 2 != n: divisors.append(n//i) i += 1 divisors.sort() return divisors N = 10 f = [0] * (N+1) for i in range(1,N+1): dn = len(make_divisors(i)) if i == dn: f[i] = i else: f[i] = f[i - dn] T = int(input()) for _ in range(T): N = int(input()) if N < 10: print(f[N]) else: print(2)