/*
red blue
3 4
red
*/
// var input ="red blue\n3 4\nred";

function main(input){
  input = input.trim();
  var g1 = input.split("\n")[0];
  var g2 = input.split("\n")[1];
  var g3 = input.split("\n")[2];
  var moji1 =g1.split(" ")[0];
  var moji2 =g1.split(" ")[1];
  var sute = g3;
  var kazu1 = parseInt(g2.split(" ")[0]);
  var kazu2 = parseInt(g2.split(" ")[1]);
  // console.log([moji1,moji2]);
  if(moji1==sute){kazu1--;}
  else if(moji2==sute){kazu2--;}
  console.log(kazu1+" "+kazu2);
}
// main(input);
main(require("fs").readFileSync("/dev/stdin","utf8"));