n,m = map(int,input().split()) for i in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 if a < b: print(0,flush = True) else: print(1,flush = True)