a = {1, 3, 4, 5, 7, 8} for _ in range(int(input())): print(int(int(input()) not in a)+1)