#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) int main() { bool not_num[10] = {}; bool in_num[10] = {}; int use_num[4] = {}; int X,Y; while(true){ for(int i = 0;i < 10;i++){ int t1 = 0; if(not_num[i]) t1++; int check = 0; for(int j = 0;j < 10;j++){ if(not_num[j]) check++; } if(check == 6) break; for(int j = i + 1;j < 10;j++){ int t2 = t1; if(not_num[j]) t2++; for(int k = j + 1;k < 10;k++){ int t3 = t2; if(not_num[k]) t3++; for(int l = k + 1;l < 10;l++){ int t4 = t3; if(not_num[l]) t4++; if(t4 != 0 && t4 != 2) { break; } if(in_num[i] || in_num[j] || in_num[k] || in_num[l]) continue; cout << i << " " << j << " " << k << " " << l << endl; cin >> X >> Y; if(X == 0 && Y == 0){ not_num[i] = true; not_num[j] = true; not_num[k] = true; not_num[l] = true; }else if(X + Y == 2 && t4 == 2){ if(!not_num[i]) in_num[i] = true; if(!not_num[j]) in_num[j] = true; if(!not_num[k]) in_num[k] = true; if(!not_num[l]) in_num[l] = true; }else if(X + Y >= 2){ break; } if(X == 4 || (X == 0 && Y == 0)) break; } if(X + Y >= 3) break; if(X == 4 || (X == 0 && Y == 0)) break; } if(X + Y >= 4) break; if(X == 4 || (X == 0 && Y == 0)) break; } if(X == 4) break; } if(X == 4) break; int how = 0; for(int i = 0;i < 10;i++){ if(not_num[i] == false){ use_num[how] = i; how++; } } for(int i = 0;i < 4;i++){ for(int j = 0;j < 4;j++){ if(i == j) continue; for(int k = 0;k < 4;k++){ if(k == i || k == j) continue; for(int l = 0;l < 4;l++){ if(l == i || l == j || l == k) continue; cout << use_num[i] << " " << use_num[j] << " " << use_num[k] << " " << use_num[l] << endl; cin >> X >> Y; if(X == 4) break; if(Y >= 2) break; } if(Y >= 3) break; if(X == 4) break; } if(Y >= 4) break; if(X == 4) break; } if(X == 4) break; } break; } return 0; }