import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val s = sc.next
  val t = sc.next
  
  val a = sc.nextInt
  val b = sc.nextInt
  
  val u = sc.next
  
  val ss = if(u == s) a - 1 else a
  val tt = if(u == t) b - 1 else b
  
  val res = s"$ss $tt"
  println(res)
}
