#include <bits/stdc++.h>
using namespace std;
long long INF = 10000000000;
int main() {
  int x, y;
  vector<int> v;
  for (int i = 0; i < 11; ++i) {
    cout << i << i << i << i << endl;
    cout << flush;
    cin >> x >> y;
    int cnt = x + y;
    if (cnt) v.push_back(i);
    if ((int)v.size() == 4) break;
  }
  do {
    cout << v[0] << v[1] << v[2] << v[3] << endl;
    cout << flush;
    cin >> x >> y;
    if (x == 4 and y == 0) return 0;
  } while (next_permutation(v.begin(), v.end()));
  return 0;
}
