import io.StdIn._

object Main extends App {

  val strList = readLine.split(" ")
  val s = strList(0)
  val t = strList(1)

  val numList = readLine.split(" ")
  var numS = numList(0).toInt
  var numT = numList(1).toInt

  val u = readLine

  if (u == s) {
    numS = numS - 1
  } else {
    numT = numT - 1
  }

  println(s"$numS $numT")

}
