using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int H, W; { int[] vs = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray(); H = vs[0]; W = vs[1]; } if (H == 1 && W == 1) { Console.WriteLine($"! {1} {1}"); return; } 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; if (Check(grid, H, W, y, x)) return; x = W - 1; Check(grid, H, W, y, x); } static bool Check(bool[,] grid, int H, int W, int y, int x) { Console.WriteLine($"? {y + 1} {x + 1}"); int d = int.Parse(Console.ReadLine()); if (d == 0) { Console.WriteLine($"! {y + 1} {x + 1}"); return true; } if (d == -1) return true; 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}"); return true; } else return false; } }