#include using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r) { return uniform_int_distribution<>(l, r)(rng); } int cnt[101]; int main() { int c = 51; cout << "? " << c << endl; int x; cin >> x; vector> posb; for (int a = 0; a <= 100; a ++) { for (int b = a + 1; b <= 100; b ++) { if ((a + c) % b == x) { posb.emplace_back(a, b); } } } for (int d = 1; d <= 100; d ++) { auto solve = [&]() { for (int i = 0; i <= 100; i ++) cnt[i] = 0; for (auto [a, b] : posb) cnt[(a + d) % b] ++; for (int i = 0; i <= 100; i ++) if (cnt[i] > 1) { // cout << "d: " << d << " cnt: " << cnt[i] << "\n"; return false; } cout << "? " << d << endl; int y; cin >> y; for (auto [a, b] : posb) { if ((a + d) % b == y) { cout << "! " << a << " " << b; break; } } return true; }; if (solve()) { return 0; } } return 0; } // 7 10