import java.util.Arrays; import java.util.Scanner; class Main { static int[] query = new int[4]; static int hit = 0; static int bite = 0; static Scanner in = new Scanner(System.in); public static void main(String[] args) throws Exception { for(int i=0; i<4; i++) { query[i] = i; } query(); for(int i=0; i<4; i++) { int best = -1; int best_j = -1; for(int j=0; j<=9; j++) { query[i] = j; if(!isValid()) { continue; } query(); if(hit + bite > best) { best = hit + bite; best_j = j; } } query[i] = best_j; } Arrays.sort(query); do { query(); } while(nextP(query)); } public static boolean isValid() { boolean[] used = new boolean[10]; for(int i=0; i<4; i++) { int x = query[i]; if(used[x]) { return false; } used[x] = true; } return true; } public static void query() { StringBuilder sb = new StringBuilder(); for(int i=0; i<4; i++) { if(i > 0) { sb.append(' '); } sb.append(query[i]); } System.out.println(sb.toString()); hit = in.nextInt(); bite = in.nextInt(); if(hit == 4) { System.exit(0); } } static boolean nextP(int[] p) { for(int a=p.length-2; a>=0; --a) { if(p[a] < p[a+1]) { for(int b=p.length-1;;--b) { if(p[b] > p[a]) { int temp = p[a]; p[a] = p[b]; p[b] = temp; for(++a, b=p.length-1; a