for _ in range(int(input())): print(1 if input() in ["1","3","4","5","7","8"] else 2)