$>.sync = true def f(n, l=-100, r=100) a = [0]*3 a[n] = l puts"? #{a*' '}" lv = gets.to_i a[n] = r puts"? #{a*' '}" rv = gets.to_i c = (l+r)/2 if lv > rv f(n, c, r) elsif lv < rv f(n, l, c) else c end end x = f(0) y = f(1) z = f(2) puts "! #{x} #{y} #{z}"