using System; using System.Linq; namespace No355{ public class Program{ public static void Main(string[] args){ Func output = s =>{ if(s.Distinct().Count() != s.Length) return -1; Console.WriteLine(string.Join(" ", s.ToCharArray())); return int.Parse(Console.ReadLine().Split(' ')[0]); }; int[] res; for(var i = 1234;; i++){ var x = output(i.ToString()); if(x == 4) return; if(x == 0){ res = i.ToString().Select(c => c - '0').ToArray(); break; } } for(var i = 0; i < 4; i++){ var max = 0; var t = 0; for(var j = 0; j < 10; j++){ res[i] = j; var x = output(string.Join("", res)); if(x == 4) return; if(x > max){ t = j; max = x; } } res[i] = t; } } } }