import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val (s, t) = Pair(scn.next(), scn.next())
	var (a, b) = Pair(scn.nextInt(), scn.nextInt())
	val u = scn.next()

	when(u){
		s -> a--
		t -> b--
	}
	print("$a $b")
}