#include <bits/stdc++.h>
using namespace std;
string arr[10] = {"0000", "1111", "2222", "3333", "4444",
                  "5555", "6666", "7777", "8888", "9999"};
int possibles[4];
int main() {
  int cnt = 0;
  for (int i = 0; i < 10; i++) {
    cout << arr[i] << endl;
    int x, y;
    cin >> x >> y;
    if (x == 1) possibles[cnt++] = i;
  }
  do {
    string curr = "";
    curr += (possibles[0] + '0');
    curr += (possibles[1] + '0');
    curr += (possibles[2] + '0');
    curr += (possibles[3] + '0');
    cout << curr << endl;
    int x, y;
    cin >> x >> y;
    if (x == 4 && y == 0) break;
  } while (next_permutation(possibles, possibles + 4));
  return 0;
}
