import Control.Applicative ((<$>))

main :: IO ()
main = do
    d <- readDice <$> getLine
    cs <- getLine
    putStrLn $ solve d cs

solve :: Dice -> String -> String
solve d "" = top d
solve (Dice t s e w n b) ('E':cs) = solve (Dice w s t b n e) cs
solve (Dice t s e w n b) ('N':cs) = solve (Dice s b e w t n) cs
solve (Dice t s e w n b) ('S':cs) = solve (Dice n t e w b s) cs
solve (Dice t s e w n b) ('W':cs) = solve (Dice e s b t n w) cs

data Dice = Dice
    { top :: String
    , south :: String
    , east :: String
    , west :: String
    , north :: String
    , bottom :: String
    }

readDice :: String -> Dice
readDice str = Dice t s e w n b
    where (t:s:e:w:n:b:_) = words str