#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, a, b;
  string s, s1;
  for (i = '0'; i <= '9'; i++) {
    s = "";
    char j = i;
    s = s + j + j + j + j;
    cout << s << endl;
    cin >> a >> b;
    if (a == 4 and b == 0) break;
    if (a > 0) {
      while (a--) {
        s1.push_back(j);
      }
    }
  }
  do {
    cout << s1 << endl;
    cin >> a >> b;
    if (a == 4 and b == 0) {
      break;
    }
  } while (next_permutation(s1.begin(), s1.end()));
  return 0;
}
