"use strict";

function Main(input) {
  let lines = input.trim().split("\n");
  let colors = lines[0].split(" ");
  let nums = lines[1].split(" ").map(x=> x*1);
  let U = lines[2];
  if(U == colors[0]){
  	nums[0] =  nums[0] - 1;
  }else {
    nums[1] =  nums[1] - 1;
  }
  console.log(`${nums[0]} ${nums[1]}`);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

