n = int(input()) if n%2 == 0: print(2, n//2, flush=True) else: print(1, (n+1)//2, flush=True) 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()) if k == 1: print(1, n+1-x, flush=True) else: print(2, n+1-(x+1), flush=True)