Problem: This problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mode. Please be sure to use the stream flushing operation after each query's output in order not to leave part of your output in some buffer. For example, in C++ you've got to use the fflush(stdout) function, in Java — call System.out.flush(), and in Pascal — flush(output).

Bulls and Cows (also known as Cows and Bulls or Pigs and Bulls or Bulls and Cleots) is an old code-breaking paper and pencil game for two players, predating the similar commercially marketed board game Mastermind.

On a sheet of paper, the first player thinks a secret string. This string consists only of digits and has the length 4. The digits in the string must be all different, no two or more equal digits are allowed.

Then the second player tries to guess his opponent's string. For every guess the first player gives the number of matches. If the matching digits are on their right positions, they are "bulls", if on different positions, they are "cows". Thus a response is a pair of numbers — the number of "bulls" and the number of "cows". A try can contain equal digits.

More formally, let's the secret string is s and the second player are trying to guess it with a string x. The number of "bulls" is a number of such positions i (1 ≤ i ≤ 4) where s[i] = x[i]. The number of "cows" is a number of such digits c that s contains c in the position i (i.e. s[i] = c), x contains c, but x[i] ≠ c.

For example, the secret string is "0427", the opponent's try is "0724", then the answer is 2 bulls and 2 cows (the bulls are "0" and "2", the cows are "4" and "7"). If the secret string is "0123", the opponent's try is "0330", then the answer is 1 bull and 1 cow.

In this problem you are to guess the string s that the system has chosen. You only know that the chosen string consists of 4 distinct digits.

You can make queries to the testing system, each query is the output of a single 4-digit string. The answer to the query is the number of bulls and number of cows. If the system's response equals "4 0", that means the interaction with your problem is over and the program must terminate. That is possible for two reasons — the program either guessed the number x or made an invalid action (for example, printed letters instead of digits).

Your program is allowed to do at most 50 queries.

You can hack solutions of other participants providing a 4-digit string containing distinct digits — the secret string.

Input

To read answers to the queries, the program must use the standard input.

The program will receive pairs of non-negative integers in the input, one pair per line. The first number in a pair is a number of bulls and the second one is a number of cows of the string s and the string xi printed by your program. If the system response equals "4 0", then your solution should terminate.

The testing system will let your program read the i-th pair of integers from the input only after your program displays the corresponding system query in the output: prints value xi in a single line and executes operation flush.

Output

The program must use the standard output to print queries.

Your program must output requests — 4-digit strings x1, x2, ..., one per line. After the output of each line the program must execute flush operation. The program should read the answer to the query from the standard input.

Your program is allowed to do at most 50 queries.

Examples

Input

0 1
2 0
1 1
0 4
2 1
4 0


Output

8000
0179
3159
3210
0112
0123

Note

The secret string s in the example is "0123".

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P753C {

  final static int [] ANS =
    {  123, 1234, 9876, 7158, 7590, 7325, 7524, 7269, 7802, 7436, 7190, 7390, 2548, 2193, 2491, 2469, 2659, 2405, 2058, 2580,
      2316, 2516, 8796, 8534, 9067, 8712, 9023, 8645, 8623, 8923, 8567, 8756,  351, 9863,  518,  263,  462,  429,  629,  374,
       128,  541, 1680, 1648, 1847, 1592, 1792, 1759, 1958, 1704, 1458, 1870, 3256, 2978, 3189, 2934, 3467, 3102, 3401, 3056,
      3024, 3214, 9584, 9340, 9530, 9274, 9706, 9451, 9641, 9618, 9362, 9562, 1047,  781,  971,  947, 1258,  893, 1094, 1072,
       815, 1026, 2478, 2134, 2645, 2389, 2589, 2345, 2756, 2501, 2701, 2456, 3807, 3561, 3974, 3719, 3918, 3895, 4096, 3840,
      4051, 4018,  946, 1257,  891,  635, 1068,  813, 1024,  746, 1279,  924, 2386, 2586, 2340, 2197, 2497, 2153, 2451, 2410,
      2610, 2365, 3718, 3917, 3671, 4095, 3829, 3582, 4017, 3750, 3950, 3694,  179,  379,  357,  547,  291, 9824,  468,  214,
       413,  379, 1520, 1943, 1687, 1876, 1632, 1598, 1798, 1543, 1743, 1720, 2850, 3284, 3028, 3218, 3195, 2938, 3149, 2873,
      3407, 3061, 4513, 4713, 4368, 4658, 4625, 4279, 4579, 4215, 4736, 4390,  865, 1076,  821, 1354,  976, 1287,  932,  897,
      1098,  843, 2307, 2507, 2160, 2683, 2418, 2618, 2594, 2349, 2539, 2184, 3647, 3846, 3814, 4025, 3759, 3958, 3926, 3680,
      3870, 3847,  453,  421,  165,  365, 9876,  532,  276,  476,  453,  643, 2018, 1752, 1496, 1695, 1673, 1863, 1608, 1807,
      1784, 1974, 3458, 3092, 2836, 3269, 3015, 3205, 2947, 3480, 3126, 3416, 9687, 9432, 9176, 9610, 9354, 9543, 9521, 9721,
      9465, 9654, 1250,  874,  852, 1063,  795,  985,  963, 1274,  917, 1208, 2580, 2548, 2748, 2491, 2147, 2659, 2405, 2604,
      2358, 2780, 8921, 8796, 9102, 8734, 8479, 9023, 8645, 8945, 8923, 9134,  596,  351,  541,  285,  263,  462,  196,  396,
       374,  573, 1936, 1680, 1870, 1847, 1592, 1792, 1537, 1958, 1704, 1904, 3278, 3024, 3214, 3189, 2934, 3145, 3102, 3401,
      3056, 3256, 9507, 9251, 9673, 9418, 9618, 9584, 9784, 9530, 9275, 9708,  948,  926, 1237,  861, 1072, 1048, 1348,  972,
      1506, 1259, 7523, 7268, 7468, 7213, 7634, 7389, 7589, 7324, 7845, 7501, 8952, 8609, 8907, 8764, 9075, 8720, 9031, 8975,
      9186, 8931,  416,  159,  359,  327,  527,  271,  471,  438,  638,  382, 1745, 1489, 1923, 1657, 1856, 1602, 2045, 1768,
      1967, 1723, 8096, 7831, 8264, 8019, 8209, 8175, 8375, 8130, 8320, 8296, 9427, 9405, 9604, 9348, 9538, 9516, 9715, 9460,
      9872, 9627, 1203,  845, 1056,  789, 1325,  957, 1268,  913, 1436, 1079, 7452, 7642, 7396, 7364, 7563, 7309, 7509, 7485,
      7158, 9431 };

  void genVars(List<int []> vars) {
    for (int a : ANS) {
      vars.add(new int [] { a / 1000, (a / 100) % 10, (a / 10) % 10, a % 10 });
    }
  }

  int [] calcBK(int [] var, int [] cv) {
    int [] bk = new int [2];

    for (int i = 0; i < 4; i++) {
      if (var[i] == cv[i]) {
        bk[0]++;
      } else {
        for (int j = 0; j < 4; j++) {
          if (var[i] == cv[j]) {
            bk[1]++;
            break;
          }
        }
      } 
    }

    return bk;
  }
  
  public void run() throws Exception {
    List<int []> vars = new ArrayList(402);
    genVars(vars);

    for (boolean eq = false; true; eq = !eq) {
System.err.println("size = " + vars.size());
      int [] cv = vars.get(0);
      println(cv[0] + "" + cv[1] + "" + cv[2] + "" + cv[3]); pw.flush();
      int [] bk = readInt(2);
      if (bk[0] == 4) { return; }

      List<int []> nvars = new ArrayList();
      for (int [] var : vars) {
        int [] cbk = calcBK(var, cv);
        if ((bk[0] == cbk[0]) && (bk[1] == cbk[1])) {
          nvars.add(var);
        }
      }

      vars = nvars;
    }
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P753C().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    return ((b > 0) ? gcd(b, a % b) : a);
  }
}