N, M = map(int, input().split()) for _ in range(M): A, B = map(int, input().split()) print(0 if A < B else 1, flush=True)