void main(){
	string[] label = _scanln!string();
	int[] balls = _scanln();
	int[string] ball_boxed;
	ball_boxed[ label[0] ] = balls[0];
	ball_boxed[ label[1] ] = balls[1];
	ball_boxed[ _scan!string() ] --;
	writefln("%d %d", ball_boxed[label[0]], ball_boxed[label[1]]);
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}
