function main(input) {
  input = input.trim();
  const a = input.split("\n");
  const co =a[0].split(" ");
  const num = a[1].split(" ").map(Number);
  if(co[0] == a[2]){
    num[0]--;
  }else{
    num[1]--;
  }
	console.log(num[0]+" "+ num[1]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));