"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = (arg[0].split(" ")[0]);
    const T = (arg[0].split(" ")[1]);
    let A = parseInt(arg[1].split(" ")[0]);
    let B = parseInt(arg[1].split(" ")[1]);
    const U = (arg[2].split(" ")[0]);
    
    if(U === S) {
        A--;
    } else {
        B--;
    }
    
    console.log(A + " " + B);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));