#include <string>
#include <iostream>

int main(int argc, char** argv) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	std::string a, b, str;
	int n, m;
	std::cin >> a >> b >> n >> m >> str;
	std::cout << (n - (str == a)) << " " << (m - (str == b)) << std::endl;
	return 0;
}