#!/usr/bin/env python3 n = int(input()) x, y = 1, 1 d = [(-1, 0), (0, 1), (1, 0), (0, -1)] def q(x, y): if x < 1 or x > n or y < 1 or y > n: return -1 print("?", x, y) return int(input()) while True: v = q(x, y) # Choose the best neighbour best = (10**18, None) for dx, dy in d: nv = q(x + dx, y + dy) if nv > v: best = min(best, (nv, (x + dx, y + dy))) if best[1] is not None: x, y = best[1] else: print("!", v) break