input = require('fs').readFileSync('/dev/stdin', 'utf8');
lines = input.split("\n");
[S, T] = lines[0].split(" ").map((s) => s.trim());
[A, B] = lines[1].split(" ").map((s) => parseInt(s.trim()));
U = lines[2].trim();
lines = input.split("\n");

console.log(`${A - (U == S)} ${B - (U == T)}`);
