#include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template ostream& operator<<(ostream &os, const pair &p) { return os << '(' << p.first << ", " << p.second << ')'; } template::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pi; const int mxN = 1e5+1, oo = 1e9; bool rec(const vector& ps, int tr=2) { if(tr==1 and ps.size()>100) return false; if(tr==0) { return ps.size()==1; } for(int x=1;x<=100;++x) { map> who; for(auto [a,b] : ps) { who[(a+x)%b].push_back({a,b}); } bool bad=0; for(const auto& [res,v] : who) { if(!rec(v,tr-1)) { bad=1; break; } } if(!bad) { return true; } } return false; } int whichx(vector ps, int tr=2) { if(tr==2) return 50; for(int x=1;x<=100;++x) { map> who; for(auto [a,b] : ps) { who[(a+x)%b].push_back({a,b}); } bool bad=0; for(auto [res,v] : who) { if(!rec(v,tr-1)) { bad=1; break; } } if(!bad) { return x; } } } int main() { vector vs; for(int a=0;a<100;++a) for(int b=a+1;b<=100;++b) { vs.push_back({a,b}); } int tr=2; // debug(rec(vs)); while(vs.size()>1) { int x = whichx(vs,tr); cout << "? " << x << '\n'; int res; cin >> res; vs.erase(partition(all(vs),[&](pi p) {return (p.first+x)%p.second==res;}),vs.end()); tr--; } cout << "! " << vs[0].first << ' ' << vs[0].second << '\n'; }