import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS8
import Data.Map.Strict ((!))
import qualified Data.Map.Strict as MapS

main=do
    [s, t] <- words<$>getLine
    [a, b] <- unfoldr (BS8.readInt . BS8.dropWhile isSpace) <$> BS8.getLine
    u <- getLine
    
    let m = MapS.fromList [(s, a), (t, b)]
        ans = MapS.insert u ((m ! u) - 1) m
    
    putStrLn $ unwords $ map show [ans ! s, ans ! t]
