import scala.io.StdIn._

object Main  {
  def main(args: Array[String]): Unit = {
    val balls = readLine.split(" ")
    val counts = readLine.split(" ").map(_.toInt)
    val thrown = readLine

    if (balls(0) == thrown) {
      println(s"${counts(0) - 1} ${counts(1)}")
    } else {
      println(s"${counts(0)} ${counts(1) - 1}")
    }

  }
}