#include using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- bool DBG = false; const int M = 100; int key[M] = { 1, 0, 4, 9, 8, 2, 3, 6, 7, 5 }; int q, a[M]; int mid(int l, int r) { if(l == 0 && r == M) { return (! DBG ? 64 : 8); } return (l + r) / 2; } int fg = 0, hi = 0; void ff(int l, int r) { if(r - l == 1) { hi++; return; } if(r - l == 2) { fg++; return; } int m = mid(l, r); ff(l, m); ff(m, r); } int ask() { inc(i, M) { if(i != 0) { cout << " "; } if(a[i] != -1) { printf("%02d", a[i]); } else { cout << "??"; } } cout << endl; int x, y, z; if(! DBG) { cin >> x >> y >> z; } else { z = 0; inc(i, M) { if(a[i] == key[i]) { z++; } } } return z; } int g(int l, int r, int vl, int vr) { int b[M]; inc(i, M) { b[i] = a[i]; } int m = mid(l, r); inc(i, M) { a[i] = (inID(i, l, r) ? (i < m ? vl : vr) : -1); } int val = ask(); inc(i, M) { a[i] = b[i]; } return val; } int h[M]; vector> bi; void f(int l, int r, vector & v) { int n = v.size(); if(DBG) { cout << " " << l << " - " << r << ": " << n << endl; inc(i, n) { cout << v[i] << " "; } cout << endl; } assert(r - l == n); if(n == 0) { return; } if(n == 1) { a[l] = v[0]; return; } if(n == 2) { bi.PB({ l, v[0], v[1] }); return; } int gg; if(n % 2 == 1) { gg = g(l, r, v[0], -1); h[v[0]] = (gg == 1 ? 0 : 1); } incID(i, n % 2, n) { gg = g(l, r, v[i], v[i + 1]); if(gg == 2) { h[v[i]] = 0; h[v[i + 1]] = 1; } if(gg == 0) { h[v[i]] = 1; h[v[i + 1]] = 0; } if(gg == 1) { gg = g(l, r, v[i], -1); h[v[i]] = h[v[i + 1]] = (gg == 1 ? 0 : 1); } i++; } vector w[2]; inc(i, n) { w[h[v[i]]].PB(v[i]); } int m = mid(l, r); f(l, m, w[0]); f(m, r, w[1]); } void setb(int bp, vector v) { inc(i, v.size()) { a[bi[bp + i][0] + 0] = bi[bp + i][1 + v[i]]; a[bi[bp + i][0] + 1] = bi[bp + i][2 - v[i]]; } } int askb(int bp, vector v) { int b[M]; setb(bp, v); inc(i, M) { b[i] = a[i]; } inc(i, M) { a[i] = -1; } setb(bp, v); int val = ask(); inc(i, M) { a[i] = b[i]; } return val / 2; } void bb() { int n = bi.size(); inc(i, n) { a[bi[i][0]] = a[bi[i][0] + 1] = -1; } inc(i, n % 4) { if(askb(i, { 0 }) == 0) { setb(i, { 1 }); } } incID(i, n % 4, n) { int gg = askb(i, { 0, 0, 0, 0 }); if(gg == 4) { } if(gg == 0) { setb(i, { 1, 1, 1, 1 }); } if(gg == 3) { int hh = askb(i, { 1, 1, 0, 0 }); if(hh == 3) { if(askb(i, { 1, 0, 0, 0 }) == 2) { setb(i, { 0, 1, 0, 0 }); } } if(hh == 1) { if(askb(i, { 0, 0, 1, 0 }) == 2) { setb(i, { 0, 0, 0, 1 }); } } } if(gg == 1) { int hh = askb(i, { 0, 0, 1, 1 }); if(hh == 3) { if(askb(i, { 0, 1, 1, 1 }) == 2) { setb(i, { 1, 0, 1, 1 }); } } if(hh == 1) { if(askb(i, { 1, 1, 0, 1 }) == 2) { setb(i, { 1, 1, 1, 0 }); } } } if(gg == 2) { int hh = askb(i, { 1, 1, 0, 0 }); if(hh == 4) { } if(hh == 0) { setb(i, { 0, 0, 1, 1 }); } if(hh == 2) { int ii = askb(i, { 0, 1, 0, 1 }); if(ii == 4) { } if(ii == 0) { setb(i, { 1, 0, 1, 0 }); } if(ii == 2) { if(askb(i, { 0, 1, 1, 0 }) == 0) { setb(i, { 1, 0, 0, 1 }); } } } } i += 3; } } int main() { if(! DBG) { cin >> q; } vector v; inc(i, M) { v.PB(i); } f(0, M, v); if(DBG) { cout << bi.size() << endl; } bb(); ask(); return 0; }