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