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