function main(input) 
{
    input = input.split("\n");
    var colour = input[0].split(" ");
    var numbers = input[1].split(" ");
    if (colour[1] == input[2])
    {
        numbers[1]--;
    }
    if (colour[2] == input[2])
    {
        numbers[2]--;
    }

    console.log("%d %d", numbers[1], numbers[2]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));.