def route(v) r = [] until v == 1 r << (v.even? ? :L : :R) v /= 2 end r.reverse.join end M = gets.to_i Q = M.times.map{gets.to_i} puts Q.map{|v| route(v + 1) }