
main :: IO()
main = do
    [s,t] <- words <$> getLine
    [a,b] <- map read . words <$> getLine
    u <- getLine
    if s == u
        then
            putStrLn $ show (a - 1) ++ " " ++ show b
        else
            putStrLn $ show a ++ " " ++ show (b - 1)
