function main(input) {
    var input = input.trim().split("\n");
    var st = input[0].split(" ");
    var ab = input[1].split(" ");
    var u = input[2];

    if (u === st[0]) {
        ab[0] --;
    } else {
        ab[1] --;
    }
    console.log(ab[0] + " " + ab[1])
}

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