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