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();
	}

} import java.util.*; util.* java 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();
	}

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

} 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();
	}

} Main
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();
	}

}
