import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList list = new ArrayList(); for(int i = 0; i < 10; i++) { for(int j = 0; j < 10; j++) { for(int k = 0; k < 10; k++) { for(int l = 0; l < 10; l++) { if((i != j) && (i != k) && (i != l) && (j != k) && (j != l) && (k != l)) list.add(i + " " + j + " " + k + " " + l); } } } } int[] flg = new int[list.size()]; int t = list.size(); for(int i = 0; i < list.size(); i++) { String s = list.get(i); System.out.println(s); System.out.flush(); int x = sc.nextInt(); int y = sc.nextInt(); if(x == 4) System.exit(0); String[] s1 = s.split(" ", 0); for(int j = 0; j < list.size(); j++) { String str = list.get(j); String[] s2 = str.split(" ", 0); int p = 0; int q = 0; for(int k = 0; k < 4; k++) { if(s1[k] == s2[k]) p++; } for(int k = 0; k < 4; k++) { for(int l = 0; l < 4; l++) { if(s1[k] == s2[l]) q++; } } if((x != p) || (y != q)) flg[j]++; } if(t == 1) break; } String ans = ""; for(int i = 0; i < list.size(); i++) { if(flg[i] == 0) ans = list.get(i); } System.out.println(ans); System.out.flush(); int x0 = sc.nextInt(); int y0 = sc.nextInt(); System.exit(0); } }