intListString :: [Int] -> String
intListString [] = ""
intListString (x:xs) = show x ++ " " ++ intListString xs

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

