using System; using System.Collections.Generic; using System.Linq; class Program { static string ReadLine() { return Console.ReadLine().Trim(); } static void Main() { int H, W; { int[] vs = ReadLine().Split().Select(_ => int.Parse(_)).ToArray(); H = vs[0]; W = vs[1]; } bool[,] grid = new bool[H, W]; for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) grid[row, col] = true; } int y = 0; int x = 0; Console.WriteLine($"? {y+1} {x + 1}"); int d = int.Parse(ReadLine()); if (d == 0) { Console.WriteLine($"! {y + 1} {x + 1}"); return; } if (d == -1) return; Check(grid, H, W, y, x, d); x = W - 1; Console.WriteLine($"? {y + 1} {x + 1}"); d = int.Parse(ReadLine()); if (d == 0) { Console.WriteLine($"! {y + 1} {x + 1}"); return; } if (d == -1) return; Check(grid, H, W, y, x, d); } static void Check(bool[,] grid, int H, int W, int y, int x, int d) { for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { if ((row - y) * (row - y) + (col - x) * (col - x) != d) grid[row, col] = false; } } int hit = 0; int hitX = 0; int hitY = 0; for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { if (grid[row, col]) { hit++; hitY = row; hitX = col; } } } if (hit == 1) Console.WriteLine($"! {hitY + 1} {hitX + 1}"); } }