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

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	}

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

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	}

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

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int A = sc.nextInt();
		int B = sc.nextInt();

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	} 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 String u = sc.next(); u sc.next() sc.next sc if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		} u.equals(s) u.equals u s {
			System.out.println((A - 1) + " " + B);
		} System.out.println((A - 1) + " " + B) System.out.println System.out System System.out (A - 1) + " " + B (A - 1) + " " + B (A - 1) A 1 " " B {
			System.out.println(A + " " + (B - 1));
		} System.out.println(A + " " + (B - 1)) System.out.println System.out System System.out A + " " + (B - 1) A + " " + (B - 1) A " " (B - 1) B 1 sc.close() sc.close sc 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();

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	}

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

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	}

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

		String u = sc.next();

		if (u.equals(s)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}

		sc.close();
	}

}
