#include #include int query(const std::string& s) { std::cout << s << std::endl; int x; std::string t; std::cin >> x >> t; if (x == 10) std::exit(0); return x; } void solve() { std::string s(10, '0'); for (int i = 0; i < 10; ++i) { int x = -1, max = -1; for (int c = 0; c <= 9; ++c) { s[i] = '0' + c; int res = query(s); if (res > max) { max = res; x = c; } } s[i] = '0' + x; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }