function Main(input) {
	var input = input.split("\n");
	var str = input[0].split(" ");
	var a = input[1].split(" ")[0];
	var b = input[1].split(" ")[1];
	var u = input[2];

	if(str[0] === u) {
		a = a - 1;
	} else {
		b = b - 1;
	}

	console.log(a+" "+b);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));