import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int size = 10; int[] numbers = new int[size]; int prev = 0; for(int i = 0; i < size; i++){ StringBuilder sb = new StringBuilder(); for(int j = 0; j < size; j++){ sb.append(numbers[j]); } System.out.println(sb.toString()); final int ret_value = sc.nextInt(); final String ret_str = sc.next(); if(ret_str.equals("unlocked")){ return; } if(ret_value <= prev){ numbers[i]++; numbers[i] %= 10; i--; } prev = ret_value; } } }