import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (s : t : _) <- T.words <$> T.getLine :: IO [T.Text]
  (a : b : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  u <- T.getLine :: IO T.Text
  let
    (a', b') | u == s    = (pred a, b)
             | otherwise = (a, pred b)
  putStr (show a')
  putStr " "
  putStrLn (show b')

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
