function Main(input) {
	input = input.split("\n");
	var st = input[0].split(" ");
	var st1 = st[0];
	var st2 = st[1];
	var num = input[1].split(" ");
	var a = parseInt(num[0], 10);
	var b = parseInt(num[1], 10);
	var st3 = input[2];
	if(st3 == st1){
      a--;
    }else{
      b--;
    }
	console.log(a+' '+b);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));