object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val S, T = sc.next
    val A, B = sc.nextInt
    val U = sc.next

    var ans = ();

    if (S == U) print(s"${A - 1} ${B}")
    else print(s"${A} ${B - 1}")
  }
}