N, M = map(int, input().split()) for i in range(M): A, B = map(int, input().split()) print(1 if A > B else 0)