import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	} main {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	} Scanner kb = new Scanner(System.in); kb new Scanner(System.in) String p = kb.next(); p kb.next() kb.next kb String q = kb.next(); q kb.next() kb.next kb int i = kb.nextInt(); i kb.nextInt() kb.nextInt kb int j = kb.nextInt(); j kb.nextInt() kb.nextInt kb String r = kb.next(); r kb.next() kb.next kb if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		} r.equals(p) r.equals r p {
			i -= 1;
		} i -= 1 i 1 if (r.equals(q)) {
			j -= 1;
		} r.equals(q) r.equals r q {
			j -= 1;
		} j -= 1 j 1 System.out.println(i + " " + j) System.out.println System.out System System.out i + " " + j i + " " + j i " " j kb.close() kb.close kb String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String p = kb.next();
		String q = kb.next();
		int i = kb.nextInt();
		int j = kb.nextInt();
		String r = kb.next();
		if (r.equals(p)) {
			i -= 1;
		} else if (r.equals(q)) {
			j -= 1;
		}
		System.out.println(i + " " + j);
		kb.close();
	}

}
