import java.util.*;
public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String s = input.next();
		String t = input.next();
		Map<String, Integer> store = new HashMap<>();
		store.put(s , input.nextInt());
		store.put(t , input.nextInt());
		String remove = input.next();
		store.put(remove , store.getOrDefault(remove, 0) - 1);
		System.out.println(store.getOrDefault(s , 0) + " " + store.getOrDefault(t, 0));
		input.close();
	}

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz