"use strict"
function Main(input) {
  input = input.trim().split('\n');
  const S = input[0].trim().split(' ')[0];
  const T = input[0].trim().split(' ')[1];
  const A = input[1].trim().split(' ').map(Number)[0];
  const B = input[1].trim().split(' ').map(Number)[1];
  const U = input[2].trim();

  if(U === S){
    console.log(A-1, B);
  }else if(U === T){
    console.log(A, B-1);
  } else {
    console.log(A, B)
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));