#include using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = long long; using P = std::tuple; using P4 = std::tuple; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; P ask(int x1, int x2, int x3, int x4){ std::cout << x1 << " " << x2 << " " << x3 << " " << x4 << std::endl; int a, b; std::cin >> a >> b; if(a == 4){ exit(0); } return std::make_tuple(a, b); } P f(int x1, int x2){ int x3, x4, mx = 0; for(int i=0;i<10;++i){ for(int j=i+1;j<10;++j){ if(i == x1 || i == x2 || j == x1 || j == x2){ continue; } int s, t; tie(s, t) = ask(x1, x2, i, j); if(mx < s + t){ mx = s + t; x3 = i; x4 = j; } } } return std::make_tuple(x3, x4); } int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int xs[4]; tie(xs[0], xs[1]) = f(0, 1); tie(xs[2], xs[3]) = f(xs[0], xs[1]); sort(xs, xs+4); while(true){ ask(xs[0], xs[1], xs[2], xs[3]); if(!next_permutation(xs, xs+4)){ break; } } }