#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t = "0000";
  for (int i = 0; i < 4; i++) {
    int x, y;
    int maxx = 0, idx = 0;
    t[i] = '0';
    cout << t << endl;
    fflush(stdout);
    cin >> x >> y;
    maxx = x;
    idx = 0;
    for (int j = 1; j < 10; j++) {
      t[i] = j + '0';
      cout << t << endl;
      fflush(stdout);
      cin >> x >> y;
      if (x > maxx) {
        maxx = x;
        idx = j;
      }
    }
    t[i] = idx + '0';
  }
  cout << t << endl;
}
