N = int(input()) if N==1: print(1,1) exit() elif N==2: print(2,1) exit() def outin(k,x): print(k,x) t = int(input()) if t < 3: exit() k,x = map(int,input().split()) return (k,x) M = (N+1)//2 k,x = outin(1 if N%2 else 2, M) while 1: if x > M: x -= M if N%2==0: x -= 1 else: x += M if N%2==0: x += 1 k,x = outin(k,x)