N, M = map(int, input().split()) for _ in range(M): u, v = map(int, input().split()) print(0 if u < v else 1)