#!/usr/bin/ python3.8 import sys readline = sys.stdin.readline # DEBUG = True DEBUG = False N = int(readline()) class Interactive: def __init__(self): self.ques_cnt = 0 self.create_data() def create_data(self): import numpy as np rank = np.arange(N + 1) np.random.shuffle(rank[1:]) self.rank = rank print('created', rank) def resp_ques(self, *args): x, y = args ret = x if self.rank[x] < self.rank[y] else y return str(ret) + '\n' def resp_ans(self, *args): x = args if self.rank[x] == 2: print('AC') else: print('WA') if DEBUG: interactive = Interactive() def question(*args, offset='?'): if offset is None: print(*args, flush=True) else: print(offset, *args, flush=True) if DEBUG: resp = interactive.resp_ques(*args) print(resp, end='') return resp else: return readline() def answer(*args, offset='!'): if offset is None: print(*args, flush=True) else: print(offset, *args, flush=True) if DEBUG: interactive.resp_ans(*args) else: exit() log = [] A = list(range(1, N + 1)) while len(A) >= 2: B = [] it = iter(A) for x, y in zip(it, it): ret = int(question(x, y)) log.append((x, y, ret)) B.append(ret) A = B best_x = A[0] A = [] for x, y, z in log: if z == best_x: A.append(x + y - z) while len(A) >= 2: B = [] it = iter(A) for x, y in zip(it, it): ret = int(question(x, y)) log.append((x, y, ret)) B.append(ret) A = B answer(A[0])