import Control.Monad solve :: [Int] -> [String] solve [] = [] solve (a:as) = (root a (flr 2 1)) : (solve as) where flr s i | a <= s = i | otherwise = flr (s + 2^(i + 1)) (i + 1) root n i | i == 0 = [] | odd n = "L" ++ root ((n - 1) `div` 2) (i - 1) | otherwise = "R" ++ root ((n - 2) `div` 2) (i - 1) main = do m <- readLn as <- replicateM m readLn mapM_ putStrLn $ solve as