object Main extends App {
  val Array(s, t) = io.StdIn.readLine().split(' ')
  val Array(a,b) = io.StdIn.readLine().split(' ').map(_.toInt)
  val u = io.StdIn.readLine()

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