#include <bits/stdc++.h>
using namespace std;
int p, c;
void print(string num) {
  p = c = 0;
  cout << num << endl;
  fflush(stdout);
  cin >> p >> c;
}
int main() {
  string s, t, ans = "";
  for (int i = 0; i < 10; i++) {
    t = to_string(i);
    s = t + t + t + t;
    print(s);
    if (p || c) ans += t;
  }
  do {
    print(ans);
    if (p == 4) break;
  } while (next_permutation(ans.begin(), ans.end()));
  return 0;
}
