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