#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
  a = b = c = d = 0;
  for (e = 0, h = 0; e <= 9; e++) {
    printf("%lld%lld%lld%lld\n", a, b, c, e);
    fflush(stdout);
    scanf("%lld %lld", &f, &g);
    if (f == 4) return 0;
    if (f > h) h = f, d = e;
  }
  for (e = 0, h = 0; e <= 9; e++) {
    printf("%lld%lld%lld%lld\n", a, b, e, d);
    fflush(stdout);
    scanf("%lld %lld", &f, &g);
    if (f == 4) return 0;
    if (f > h) h = f, c = e;
  }
  for (e = 0, h = 0; e <= 9; e++) {
    printf("%lld%lld%lld%lld\n", a, e, c, d);
    fflush(stdout);
    scanf("%lld %lld", &f, &g);
    if (f == 4) return 0;
    if (f > h) h = f, b = e;
  }
  for (e = 0, h = 0; e <= 9; e++) {
    printf("%lld%lld%lld%lld\n", e, b, c, d);
    fflush(stdout);
    scanf("%lld %lld", &f, &g);
    if (f == 4) return 0;
    if (f > h) h = f, a = e;
  }
  return 0;
}
