N=int(input()) TOURNAMENT=[list(range(1,N+1))] WINLIST=[] while len(TOURNAMENT[-1])!=1: LEN=len(TOURNAMENT[-1]) NEXT=[] for i in range(0,LEN,2): if i==LEN-1: NEXT.append(TOURNAMENT[-1][i]) break x=TOURNAMENT[-1][i] y=TOURNAMENT[-1][i+1] print("?",x,y,flush=True) win=int(input()) if x==win: NEXT.append(x) WINLIST.append([x,y]) else: NEXT.append(y) WINLIST.append([y,x]) TOURNAMENT.extend([NEXT]) WIN1=TOURNAMENT[-1][-1] TOURNAMENT2=[] for x,y in WINLIST: if x==WIN1: TOURNAMENT2.append(y) TOURNAMENT=[TOURNAMENT2] while len(TOURNAMENT[-1])!=1: LEN=len(TOURNAMENT[-1]) NEXT=[] for i in range(0,LEN,2): if i==LEN-1: NEXT.append(TOURNAMENT[-1][i]) break x=TOURNAMENT[-1][i] y=TOURNAMENT[-1][i+1] print("?",x,y,flush=True) win=int(input()) if x==win: NEXT.append(x) WINLIST.append([x,y]) else: NEXT.append(y) WINLIST.append([y,x]) TOURNAMENT.extend([NEXT]) print(TOURNAMENT[-1][-1])