function main(input) {
    var s = input[0].split(" ")[0];
    var t = input[0].split(" ")[1];
    var a = input[1].split(" ")[0]-0;
    var b = input[1].split(" ")[1]-0;
    var u = input[2];
    var map = {[s]: a, [t]: b};
    map[u]--;
    console.log(map[s] + " " + map[t]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
