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