from strutils import parseInt from sequtils import mapIt let N = stdin.readLine.parseInt var participants = (1..N).mapIt(it) proc ask(x, y: int): int = echo "? ", x, " ", y stdin.readLine.parseInt var next = newSeq[int]() while participants.len > 2: next = @[] for i in countup(1, participants.len, 2): let ans = ask(participants[i - 1], participants[i]) next.add(ans) participants = next let ans = ask(participants[0], participants[1]) echo "! ", participants[participants.find(ans) xor 1]