#include using namespace std; int ask(int i, int j) { cout << "? " << i << " " << j << endl; int d; cin >> d; assert(d != -1); return d; } void ans(int i, int j) { cout << "! " << i << " " << j << endl; exit(0); } 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; int d1 = ask(1, 1); if(d1 == 0) ans(1, 1); for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) { if((i != 1 || j != 1) && dist(i - 1, j - 1) == d1) { int d2 = ask(i, j); if(d2 == 0) ans(i, j); bool f = false; for(int ii = 1; ii <= H; ii++) for(int jj = 1; jj <= W; jj++) { if(dist(ii - 1, jj - 1) == d1 && dist(ii - i, jj - j) == d2) { if(f) { ans(ii, jj); } int d3 = ask(ii, jj); if(d3 == 0) { ans(ii, jj); } f = true; } } assert(0); } } }