#include <bits/stdc++.h>
using namespace std;
int main() {
  long long bulls = 0, cows = 0, bullsm, l1 = 0, l2 = 0, l3 = 0, l4 = 0;
  for (long long i = 0; i < 10; i++) {
    cout << "000" << i << endl;
    fflush(stdout);
    cin >> bulls >> cows;
    if (i == 0) bullsm = bulls;
    if (bullsm < bulls) l4 = i;
  }
  bulls = bullsm = cows = 0;
  for (long long i = 0; i < 10; i++) {
    cout << "00" << i << "0" << endl;
    fflush(stdout);
    cin >> bulls >> cows;
    if (i == 0) bullsm = bulls;
    if (bullsm < bulls) l3 = i;
  }
  bulls = bullsm = cows = 0;
  for (long long i = 0; i < 10; i++) {
    cout << "0" << i << "00" << endl;
    fflush(stdout);
    cin >> bulls >> cows;
    if (i == 0) bullsm = bulls;
    if (bullsm < bulls) l2 = i;
  }
  bulls = bullsm = cows = 0;
  for (long long i = 0; i < 10; i++) {
    cout << i << "000" << endl;
    fflush(stdout);
    cin >> bulls >> cows;
    if (i == 0) bullsm = bulls;
    if (bullsm < bulls) l1 = i;
  }
  cout << l1 << l2 << l3 << l4 << endl;
  fflush(stdout);
  return 0;
}
