from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,copy,time sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(input()) def inpl(): return list(map(int, input().split())) def inpl_str(): return list(input().split()) N = inp() lines = defaultdict(set) tops = [i+1 for i in range(N)] newtops = [] while len(tops) >= 2: for i in range(0,len(tops)//2*2,2): x, y = tops[i],tops[i+1] print('?',x,y) if inp() == x: lines[x].add(y) newtops.append(x) else: lines[y].add(x) newtops.append(y) if len(tops)%2 == 1: tops = [tops[-1]] + newtops[:] else: tops = newtops[:] newtops = [] seconds = list(lines[tops[0]]) ans = seconds[0] for i in range(1,len(seconds)): s = seconds[i] print('?',ans,s) if inp() != ans: ans = s print('!',ans)