main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      ls <- getLine
      let order = take 100 (cycle [1..n])
          init = zip [1..n] (repeat 0)
      putStrLn $ solve init order ls 0
      main

solve :: [(Int,Int)] -> [Int] -> String -> Int -> String
solve hand _ [] field = format ((sort (toList hand)) ++ [field])
  where
    format :: [Int] -> String
    format [] = []
    format [x] = show x
    format (x:xs) = (show x) ++ " " ++ (format xs)
    sort :: [Int] -> [Int]
    sort [] = []
    sort (x:xs) = (sort (filter (\y -> y <= x) xs)) ++ [x] ++ (sort (filter (\y -> y > x) xs))
    toList :: [(Int,Int)] -> [Int]
    toList [] = []
    toList ((a,b):r) = b:(toList r)
solve hand (x:xs) (y:ys) field
  | y == 'M' = solve (plus hand x) xs ys field
  | y == 'S' = solve (zero hand x) xs ys (add field hand x)
  | y == 'L' = solve (get hand x field) xs ys 0
  where
    plus :: [(Int,Int)] -> Int -> [(Int,Int)]
    --plus [] _ = []
    plus ((a,b):r) i
      | a == i = (a,b+1):r
      | otherwise = (a,b):(plus r i)
    zero :: [(Int,Int)] -> Int -> [(Int,Int)]
    --zero [] _ = []
    zero ((a,b):r) i
      | a == i = (a,0):r
      | otherwise = (a,b):(zero r i)
    add :: Int -> [(Int,Int)] -> Int -> Int
    --add field [] _ = field
    add field ((a,b):r) i
      | a == i = field + b + 1
      | otherwise = add field r i
    get :: [(Int,Int)] -> Int -> Int -> [(Int,Int)]
    --get [] _ _ = []
    get ((a,b):r) i field
      | a == i = (a,b+field+1):r
      | otherwise = (a,b):(get r i field)