#include <bits/stdc++.h>
using namespace std;
int main() {
  int counter = 0, chosenDigits[4], index = 0, response;
  ;
  for (int i = 0; i < 10; i++) {
    cout << i << i << i << i << endl;
    fflush(stdout);
    cin >> response;
    if (response) {
      chosenDigits[index++] = i;
      ++counter;
    }
    cin >> response;
    if (counter == 4) break;
  }
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++) {
      if (j == i) continue;
      for (int k = 0; k < 4; k++) {
        if (k == i || k == j) continue;
        for (int y = 0; y < 4; y++) {
          if (y == i || y == j || y == k) continue;
          cout << chosenDigits[i] << chosenDigits[j] << chosenDigits[k]
               << chosenDigits[y] << endl;
          fflush(stdout);
          cin >> response;
          if (response == 4) return 0;
          cin >> response;
        }
      }
    }
  return 0;
}
