s = gets.chomp a = ["L","R"] t = 0 loop{ if s[0] == "M" break end s = s.to_i if s > 0 puts "F" STDOUT.flush else puts a[t] STDOUT.flush s = gets.to_i if s == 0 puts a[t] STDOUT.flush s = gets.to_i puts a[t] STDOUT.flush t = 1 - t else puts "F" STDOUT.flush end end s = gets.chomp }