object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s, t = sc.next()
  val a, b = sc.nextInt()
  val u = sc.next()
  var num_s = -1
  var num_t = -1
  if (s==u) {
    num_s = a - 1
    num_t = b
  } else {
    num_s = a
    num_t = b - 1
  }
  println(s"$num_s $num_t")
}
