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