#include #include #include using namespace std; vector adj[100]; int match_to[100]; bool visited[100]; bool dfs(int u) { for (int v : adj[u]) { if (!visited[v]) { visited[v] = true; if (match_to[v] == -1 || dfs(match_to[v])) { match_to[v] = u; return true; } } } return false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int Q; cin >> Q; int cnt1[10][10] = {0}; int cnt2[10][10] = {0}; int cnt1u[10][10] = {0}; int cnt2u[10][10] = {0}; for (int g1 = 0; g1 < 10; ++g1) { for (int x = 0; x < 10; ++x) { for (int i = 0; i < 100; ++i) { if (i / 10 == g1) { cout << (char)('0' + x) << "? "; } else { cout << "?? "; } } cout << '\n'; cout.flush(); int p0, p1, p2; cin >> p0 >> p1 >> p2; cnt1[g1][x] = p1; } } for (int g1 = 0; g1 < 10; ++g1) { for (int y = 0; y < 10; ++y) { for (int i = 0; i < 100; ++i) { if (i / 10 == g1) { cout << "?" << (char)('0' + y) << " "; } else { cout << "?? "; } } cout << '\n'; cout.flush(); int p0, p1, p2; cin >> p0 >> p1 >> p2; cnt2[g1][y] = p1; } } for (int g2 = 0; g2 < 10; ++g2) { for (int x = 0; x < 10; ++x) { for (int i = 0; i < 100; ++i) { if (i % 10 == g2) { cout << (char)('0' + x) << "? "; } else { cout << "?? "; } } cout << '\n'; cout.flush(); int p0, p1, p2; cin >> p0 >> p1 >> p2; cnt1u[g2][x] = p1; } } for (int g2 = 0; g2 < 10; ++g2) { for (int y = 0; y < 10; ++y) { for (int i = 0; i < 100; ++i) { if (i % 10 == g2) { cout << "?" << (char)('0' + y) << " "; } else { cout << "?? "; } } cout << '\n'; cout.flush(); int p0, p1, p2; cin >> p0 >> p1 >> p2; cnt2u[g2][y] = p1; } } for (int x = 0; x < 10; ++x) { for (int y = 0; y < 10; ++y) { int u = x * 10 + y; for (int i = 0; i < 100; ++i) { int g1 = i / 10; int g2 = i % 10; if (cnt1[g1][x] > 0 && cnt2[g1][y] > 0 && cnt1u[g2][x] > 0 && cnt2u[g2][y] > 0) { adj[u].push_back(i); } } } } memset(match_to, -1, sizeof(match_to)); for (int u = 0; u < 100; ++u) { memset(visited, 0, sizeof(visited)); dfs(u); } for (int i = 0; i < 100; ++i) { int val = match_to[i]; cout << (char)('0' + (val / 10)) << (char)('0' + (val % 10)) << " "; } cout << '\n'; cout.flush(); int p0, p1, p2; cin >> p0 >> p1 >> p2; return 0; }