object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val S, T = sc.next
  var A, B = sc.nextInt
  val U = sc.next
  
  if (U == S) {
    A -= 1 
  } else {
    B -= 1
  }

  printf(A + " " + B)
}
