module Main where


printResult (s, t) (a, b) u
  | s == u = putStrLn (mconcat [show (a - 1), " ", show b])
  | t == u = putStrLn (mconcat [show a, " ", show (b - 1)])
  | otherwise = putStrLn (mconcat [show a, " ", show b])


main :: IO ()
main =
  words <$> getLine >>= \[s, t] ->
  (map (read :: String -> Int) . words) <$> getLine >>= \[a, b] ->
  getLine >>= \u ->
  printResult (s, t) (a, b) u
