n = int(input()) if n%2 == 1: print(1,(n+1)//2) else: print(2,n//2) while True: t = int(input()) if t<=1: break k,x = map(int, input().split()) print(n-x+2-k)