#include typedef long long ll; typedef std::pair P; typedef std::priority_queue, std::greater

> PQ; int main() { int h, w; std::cin >> h >> w; if (h == 1 && w == 1) { std::cout << "! 1 1" << std::endl; return 0; } std::cout << "? 1 1" << std::endl; ll d; std::cin >> d; std::vector> grid(h + 1, std::vector(w + 1, false)); int count = 0; int tempi = 0, tempj = 0; for (int i = 1; i <= h; ++i) { for (int j = 1; j <= w; ++j) { if ((i - 1) * (i - 1) + (j - 1) * (j - 1) == d) { count++; tempi = i; tempj = j; grid[i][j] = true; } } } if (count == 1) { std::cout << "! " << tempi << " " << tempj << std::endl; return 0; } int tw = 2; std::cout << "? " << 1 << " " << tw << std::endl; std::cin >> d; count = 0; tempi = 0, tempj = 0; for (int i = 1; i <= h; ++i) { for (int j = 1; j <= w; ++j) { if (grid[i][j] && (1 - i) * (1 - i) + (tw - j) * (tw - j) == d) { count++; tempi = i; tempj = j; } else { grid[i][j] = false; } } } if (count == 1) { std::cout << "! " << tempi << " " << tempj << std::endl; return 0; } std::cout << "? " << 1 << " " << w << std::endl; std::cin >> d; count = 0; tempi = 0, tempj = 0; for (int i = 1; i <= h; ++i) { for (int j = 1; j <= w; ++j) { if (grid[i][j] && (i - 1) * (i - 1) + (w - j) * (w - j) == d) { count++; tempi = i; tempj = j; } else { grid[i][j] = false; } } } if (count == 1) { std::cout << "! " << tempi << " " << tempj << std::endl; return 0; } std::cout << "? " << h << " " << 1 << std::endl; std::cin >> d; count = 0; tempi = 0, tempj = 0; for (int i = 1; i <= h; ++i) { for (int j = 1; j <= w; ++j) { if (grid[i][j] && (h - i) * (h - i) + (1 - j) * (1 - j) == d) { count++; tempi = i; tempj = j; } else { grid[i][j] = false; } } } if (count == 1) { std::cout << "! " << tempi << " " << tempj << std::endl; return 0; } }