import scala.io.StdIn

object Main extends App {
  val ballColors = StdIn.readLine.split(" ")
  val ballNum = StdIn.readLine.split(" ").map(_.toInt)
  val takeColor = StdIn.readLine

  if (ballColors(0) == takeColor) {
    ballNum(0) = ballNum(0)-1
    } else {
    ballNum(1) = ballNum(1)-1
  }
  println(ballNum.mkString(" "))
}
