main = do
  str <- getLine
  let [s, t] = words str
  str <- getLine
  let [a, b] = map read (words str) ::[Int]
  u <- getLine
  if u == s
    then putStrLn $ unwords $ map show [a-1, b]
    else putStrLn $ unwords $ map show [a, b-1]