local function query(a, b) io.write("? " .. a .. " " .. b .. "\n") io.flush() local ret = io.read("*l") return tonumber(ret) end local function ans(a) io.write("! " .. a .. "\n") io.flush() end local n = io.read() n = tonumber(n) local t = {} local d = {} d[1] = {} for i = 1, n do t[i] = {} d[1][i] = i end local stage = 1 while 1 < #d[stage] do d[stage + 1] = {} for i = 1, #d[stage], 2 do if i ~= #d[stage] then local v1, v2 = d[stage][i], d[stage][i + 1] local ret = query(v1, v2) table.insert(d[stage + 1], ret) if v1 == ret then table.insert(t[v1], v2) else table.insert(t[v2], v1) end else table.insert(d[stage + 1], d[stage][i]) end end stage = stage + 1 end local top = d[stage][1] local second = t[top][1] for i = 2, #t[top] do local v = t[top][i] local ret = query(second, v) second = ret end ans(second)