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