object Main extends App{
  val List(s,t) = readLine.split(" ").toList
  val List(a,b) = readLine.split(" ").map(_.toInt).toList
  val u = readLine.split(" ").toList(0)
  
  val x = if(u == s) a-1 else a
  val y = if(u == t) b-1 else b  
  println(x + " " + y)
}