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