import java.util.*; import java.io.*; public class Exercise47{ public static void main (String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String nums = "0000000000"; String[] numArray = nums.split(""); a: for (int a = 0; a < 10; a++){ b: for (int b = 0; b < 10; b++){ System.out.println(nums); System.out.flush(); String result = new String(in.readLine()); int resultBeforeNum = getAnswer(result); if (resultBeforeNum == 10){ break a; } int currentNum = Integer.parseInt(numArray[a]); int changedNum = currentNum + 1; numArray[a] = String.valueOf(changedNum); String newNums = ""; for (int n = 0; n < 10; n++){ newNums += numArray[n]; } System.out.println(newNums); System.out.flush(); result = new String(in.readLine()); int resultAfterNum = getAnswer(result); if (resultAfterNum == 10){ break a; }else if (resultAfterNum > resultBeforeNum){ nums = newNums; break b; }else if (resultAfterNum < resultBeforeNum){ numArray[a] = String.valueOf(currentNum); break b; } } } } public static int getAnswer(String result){ String[] resultArray = result.split(" "); int resultNum = Integer.parseInt(resultArray[0]); return resultNum; } }