#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a vector compress(vector v){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return v; } //INSERT ABOVE HERE int ask(int a,int b,int c,int d){ cout<>x>>y; if(x==4) exit(0); return x+y; } signed main(){ vector cs; { vector vs(10,0); int tmp=0; for(int i=3;i<10;i++){ vs[i]=ask(0,1,2,i); chmax(tmp,vs[i]); } for(int i=3;i<10;i++){ if(vs[i]==tmp) cs.emplace_back(i); } } { vector vs(10,0); int tmp=0; for(int i=0;i<7;i++){ vs[i]=ask(i,7,8,9); chmax(tmp,vs[i]); } for(int i=0;i<7;i++){ if(vs[i]==tmp) cs.emplace_back(i); } } cs=compress(cs); do{ ask(cs[0],cs[1],cs[2],cs[3]); }while(next_permutation(cs.begin(),cs.end())); return 0; }