main :: IO ()
main = do
  [s,t] <- words <$> getLine
  [a,b] <- map (read :: String -> Int) . words <$> getLine
  u <- getLine
  if s == u then putStrLn $ show (a-1) ++ " " ++ show b
    else putStrLn $ show a ++ " " ++ show (b-1)