#include using namespace std; void ans(int i, int j) { cout << "! " << i << " " << j << endl; exit(0); } int ask(int i, int j) { cout << "? " << i << " " << j << endl; int d; cin >> d; if(d == 0) ans(i, j); assert(d != -1); return d; } int dist(int x, int y) { return x * x + y * y; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int H, W; cin >> H >> W; if(H == 1 && W == 1) ans(1, 1); int d1 = ask(1, 1); vector> ss; for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) { if(dist(i - 1, j - 1) == d1) ss.push_back({i, j}); } if(ss.size() == 1) { ans(ss.front().first, ss.front().second); } int d2 = ask(1, W); for(const auto&[i, j]: ss) { if(dist(i - 1, W - j) == d2) { ans(i, j); } } }