main :: IO ()
main = do
  [s, t] <- words <$> getLine
  [a, b] <- map read . words <$> getLine
  u <- getLine
  putStrLn . unwords . map show $ solve s t a b u

solve :: String -> String -> Int -> Int -> String -> [Int]
solve s _ a b u
  | s == u    = [a - 1, b]
  | otherwise = [a, b - 1]
