fun main(args: Array<String>) {
  val (S, T) = readLine()!!.split(" ")
  val (A, B) = readLine()!!.split(" ").map(String::toInt)
  val U = readLine()!!
  println("%d %d".format(if (U == S) A - 1 else A, if (U == T) B - 1 else B))
}