object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val pw = new java.io.PrintWriter(System.out)
	
	val s, _ = sc.next
	val a, b = sc.nextInt
	val ua = if (sc.next == s) 1 else 0
	val ub = if (ua == 1) 0 else 1
	
	pw.println(s"${a - ua} ${b - ub}")
	pw.flush()
}