import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	} main {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		} U.contentEquals(S) U.contentEquals U S {
			A -= 1;
		} A -= 1 A 1 {
			B -= 1;
		} B -= 1 B 1 System.out.println(A + " " + B) System.out.println System.out System System.out A + " " + B A + " " + B A " " B String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String T = scanner.next();
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		String U = scanner.next();

		if (U.contentEquals(S)) {
			A -= 1;
		} else {
			B -= 1;
		}
		System.out.println(A + " " + B);
	}
}