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