#include <bits/stdc++.h>
using namespace std;
int d[5];
int main() {
  int i, x, y, mx;
  mx = 0;
  for (i = 0; i <= 9; i++) {
    cout << i << "000" << endl;
    cin >> x >> y;
    if (x == 4) return 0;
    if (x > mx) {
      mx = x;
      d[1] = i;
    }
  }
  mx = 0;
  for (i = 0; i <= 9; i++) {
    cout << d[1] << i << "00" << endl;
    cin >> x >> y;
    if (x == 4) return 0;
    if (x > mx) {
      mx = x;
      d[2] = i;
    }
  }
  mx = 0;
  for (i = 0; i <= 9; i++) {
    cout << d[1] << d[2] << i << "0" << endl;
    cin >> x >> y;
    if (x == 4) return 0;
    if (x > mx) {
      mx = x;
      d[3] = i;
    }
  }
  for (i = 0; i <= 9; i++) {
    cout << d[1] << d[2] << d[3] << i << endl;
    cin >> x >> y;
    if (x == 4) return 0;
  }
}
