#include <bits/stdc++.h>
using namespace std;
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int Set(int N, int pos) { return (N | (1 << pos)); }
int fx[] = {-1, 0, 1, 0};
int fy[] = {0, 1, 0, -1};
inline long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
vector<char> v;
int main() {
  for (int i = 0; i < 4; i++) {
    int mx = 0;
    string str = "0000";
    char ch;
    for (int j = 0; j < 10; j++) {
      str[i] = '0' + j;
      cout << str << endl;
      int a, b;
      cin >> a >> b;
      if (a > mx) {
        ch = str[i];
        mx = a;
      }
      if (mx == 4) break;
    }
    v.push_back(ch);
  }
  for (int i = 0; i < v.size(); i++) cout << v[i];
  cout.flush();
}
