import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	}
} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc Map<String,Integer> map = new HashMap<>(); map new HashMap<>() map.put(s, a) map.put map s a map.put(t, b) map.put map t b String u = sc.next(); u sc.next() sc.next sc map.put(u,map.get(u)-1) map.put map u map.get(u)-1 map.get(u) map.get map u 1 System.out.println(map.get(s)+ " " + map.get(t)) System.out.println System.out System System.out map.get(s)+ " " + map.get(t) map.get(s)+ " " + map.get(t) map.get(s) map.get map s " " map.get(t) map.get map t String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	}
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int a = sc.nextInt();
		int b = sc.nextInt();

		Map<String,Integer> map = new HashMap<>();
		map.put(s, a);
		map.put(t, b);

		String u = sc.next();
		map.put(u,map.get(u)-1);

		System.out.println(map.get(s)+ " " + map.get(t));
	}
}