"use strict";

const main = arg => {
    // 標準入力の不要な空白と改行を削除し、配列に格納する
    const input = arg.trim().split("\n");
    const strngs = input[0].split(" ");
    const A = Math.floor(input[1].split(" ")[0], 10);
    const B = Math.floor(input[1].split(" ")[1], 10);
    const U = input[2];

    if ( U === strngs[0]) {
        console.log((A - 1), B);
    } else {
        console.log(A, (B - 1));
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  