'use strict'


function Main(input) {
  input = input.trim().split('\n')
  const array = input[0].split(' ')
  const res = input[1].split(' ').map(s => parseInt(s))

  const S = array[0]
  const T = array[1]
  let A = res[0]
  let B = res[1]

  const U = input[2]

  if (U === S) {
    A -= 1
  } else {
    B -= 1
  }

  console.log(`${A} ${B}`)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));