main = do
    [s, t] <- words <$> getLine :: IO [String]
    [si,ti] <- map read . words <$> getLine  :: IO [Int]
    u <- getLine :: IO String
    putStr $ show $ if u == s then si - 1 else si
    putChar ' '
    putStrLn $ show $ if u == t then ti - 1 else ti