import scala.io.StdIn._

object Main  {
  def main(args: Array[String]): Unit = {
    val (b1, b2): (String, String) = readLine.split(" ")
    val (c1, c2): (Int, Int) = readLine.split(" ").map(_.toInt)
    val thrown = readLine
    if (b1 == thrown) {
      println(s"${c1 - 1} $c2")
    } else {
      println(s"$c1 ${c2 - 1}")
    }

  }
}