{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  (c0:cs) <- getLine

  d <- VM.new n

  let inito0 = do
        VM.set d '-'
        VM.write d (n-1) 'W'
        VM.write d 0     'S'
        VM.write d 1     'W'
      inito1 = do
        VM.set d '-'
        VM.write d (n-1) 'S'
        VM.write d 0     'S'
        VM.write d 1     'S'
      inito2 = do
        VM.set d '-'
        VM.write d (n-1) 'W'
        VM.write d 0     'W'
        VM.write d 1     'S'
      inito3 = do
        VM.set d '-'
        VM.write d (n-1) 'S'
        VM.write d 0     'W'
        VM.write d 1     'W'

  let initx0 = do
        VM.set d '-'
        VM.write d (n-1) 'W'
        VM.write d 0     'W'
        VM.write d 1     'W'
      initx1 = do
        VM.set d '-'
        VM.write d (n-1) 'S'
        VM.write d 0     'W'
        VM.write d 1     'S'
      initx2 = do
        VM.set d '-'
        VM.write d (n-1) 'W'
        VM.write d 0     'S'
        VM.write d 1     'S'
      initx3 = do
        VM.set d '-'
        VM.write d (n-1) 'S'
        VM.write d 0     'S'
        VM.write d 1     'W'


  let initsx :: [IO ()]
      initsx = [initx0, initx1, initx2, initx3]
      initso :: [IO ()]
      initso = [inito0, inito1, inito2, inito3]

  let expectedChar i = do
        tn_2 <- VM.read d (i-1)
        tn_1 <- VM.read d i
        t0   <- VM.read d (if i == n-1 then 0 else i+1)
        if tn_2 == t0
          then return (if tn_1 == 'S' then 'o' else 'x')
          else return (if tn_1 == 'S' then 'x' else 'o')

      flipT 'S' = 'W'
      flipT 'W' = 'S'

  let solve :: Int -> String -> IO Bool
      solve i [c]= do
        e <- expectedChar i
        return (c == e)
      solve i (c:[x])= do
        e <- expectedChar i
        if (c == e)
          then solve (i+1) [x]
          else return False
      solve i ('o':cs) = do
        ti_1 <- VM.read d (i-1)
        ti   <- VM.read d i
        if ti == 'W'
          then VM.write d (i+1) (flipT ti_1)
          else VM.write d (i+1) ti_1
        solve (i+1) cs
      solve i ('x':cs) = do
        ti_1 <- VM.read d (i-1)
        ti   <- VM.read d i
        if ti == 'S'
          then VM.write d (i+1) (flipT ti_1)
          else VM.write d (i+1) ti_1
        solve (i+1) cs

      initsc = if c0 == 'o' then initso else initsx

      solveAll [] = print (-1)
      solveAll (f:fs) = do
        f
        res <- solve 1 cs
        if res
          then do v <- V.freeze d
                  let d' = V.toList v
                  putStrLn d'
                  -- print $ checkResult v 0
          else solveAll fs

      checkResult v i
        | i == n = (True, i)
        | otherwise = let l = if i == 0 then v V.! (n-1) else v V.! (i-1)
                          t = v V.! i
                          r = if i == (n-1) then v V.! 0 else v V.! (i+1)
                          mk = (c0:cs) !! i
                          ok | t == 'S' && mk == 'o' = l == r
                             | t == 'S' && mk == 'x' = l /= r
                             | t == 'W' && mk == 'o' = l /= r
                             | t == 'W' && mk == 'x' = l == r
                      in if ok then checkResult v (i+1)
                         else (False, i)


  solveAll initsc


Measured memory_bytes: 7548