const main = stdin => {
  const input = stdin.trim().split('\n')
  const [S, T] = input[0].split(' ')
  const [A, B] = input[1].split(' ').map(x => parseInt(x))
  const U = input[2]

  const balls = {
    [S]: A,
    [T]: B
  }

  balls[U]--

  console.log(balls[S], balls[T])
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
