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