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