#!/usr/bin/env python3 import random n = int(input()) 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()) x, y = n // 2, n // 2 # Sample n random points, and start at the best one. best = 0 for i in range(10 * n): window = i // 10 + 1 xi = random.randint(max(1, x - window), min(n, x + window)) yi = random.randint(max(1, y - window), min(n, y + window)) v = q(xi, yi) if v > best: best = v x, y = xi, yi print("!", best)