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