import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

readString = map BS.unpack . BS.words

getIntList = readIntList <$> BS.getLine

getString = readString <$> BS.getLine

main = do
  [s, t] <- getString
  [a, b] <- getIntList
  [u] <- getString
  let abs
        | u == s = [a -1, b]
        | u == t = [a, b -1]
  mapM_ putStr (map (\x -> show x ++ " ") abs)
