a = Array.new(10, 0) x = "%010d" % 0 puts x STDOUT.flush str = gets.split zero_num = str[0].to_i if str[1] == "unlocked" exit end 9.times do |i| i += 1 y = i 10.times do |j| s = "%010d" % y puts s STDOUT.flush y *= 10 str = gets.split if str[1] == "unlocked" exit end h = str[0].to_i if h > zero_num a[9 - j] = i end end end puts a.join STDOUT.flush