import Control.Monad (replicateM) main :: IO () main = do n <- readLn as <- replicateM n readLn mapM_ putStrLn $ solve as solve :: [Int] -> [String] solve = map (table !!) table :: [String] table = ("" :) $ concat $ do n <- [1 ..] return $ zipWith gen (repeat n) [0 .. 2 ^ n - 1] where gen :: Int -> Int -> String gen l x = do x' <- replicate (l - length b) '0' ++ b return $ if x' == '0' then 'L' else 'R' where b = intToBinStr x -- ref: http://haskell.g.hatena.ne.jp/noritsugu/20080905/Hole6 intToBin :: Int -> [Int] intToBin 0 = [] intToBin n = n `mod` 2 : intToBin (n `div` 2) intToBinStr :: Int -> String intToBinStr = concatMap show . reverse . intToBin