import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") def out(k,x): print(" ".join(map(str, (k,x)))) import sys sys.stdout.flush() n = int(input()) if n%2==0: out(2, n//2-1) else: out(1, n//2) while True: t = int(input()) if t in (0,1): break k,x = map(int, input().split()) if t==2: break out(k, n+1-x-(k-1))