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