import scala.io.StdIn._

object Main extends App {


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

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

  println(solve())

}

