fun main(args: Array<String>) {
  val st = readLine()!!.split(" ")
  val ab = readLine()!!.split(" ").map { it.toInt() }
  val u = readLine()!!
  if (st[0] == u) {
    print("${ab[0] - 1} ${ab[1]}")
  } else {
    print("${ab[0]} ${ab[1] - 1}")
  }
}