import scala.io.StdIn.readLine

object Main extends App {

  val Array(s, t) = readLine().split(" ")
  val Array(a, b) = readLine().split(" ").map(_.toInt)
  val u = readLine()

  if (u == s)
    println(s"${a - 1} ${b}")
  else
    println(s"${a} ${b - 1}")
}
