#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef vector VI; typedef vector VVI; typedef vector VL; typedef vector VVL; typedef long long LL; #define all(a) (a).begin(), (a).end() #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define ALL(a) (a).begin(),(a).end() #define pb push_back int main() { VI X,Y; queue D; D.push({0,1000000}); while(D.size()>0){ VI z=D.front(); D.pop(); if(z[0]==z[1]){X.pb(z[0]);continue;} int r=(z[0]+z[1])/2; bool h; cout<<"? "<>h; if(h){D.push({z[0],r});} cout<<"? "<>h; if(h){D.push({r+1,z[1]});} } D.push({0,1000000}); while(D.size()>0){ VI z=D.front(); D.pop(); if(z[0]==z[1]){Y.pb(z[0]);continue;} int r=(z[0]+z[1])/2; bool h; cout<<"? "<<0<<' '<<1000000<<' '<>h; if(h){D.push({z[0],r});} cout<<"? "<<0<<' '<<1000000<<' '<>h; if(h){D.push({r+1,z[1]});} } sort(all(Y)); int m=Y.size(); VVI ans; for(int x : X){ D.push({0,m-1}); while(D.size()>0){ VI z=D.front();D.pop(); if(z[0]==z[1]){ ans.pb({x,Y[z[0]]}); continue; } int r=(z[0]+z[1])/2; bool h; cout<<"? "<>h; if(h){D.push({z[0],r});} cout<<"? "<>h; if(h){D.push({r+1,z[1]});} } } cout<<"! "<