import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	} Scanner scannerS = new Scanner(System.in); scannerS new Scanner(System.in) String S = scannerS.next(); S scannerS.next() scannerS.next scannerS String T = scannerS.next(); T scannerS.next() scannerS.next scannerS int A = scannerS.nextInt(); A scannerS.nextInt() scannerS.nextInt scannerS int B = scannerS.nextInt(); B scannerS.nextInt() scannerS.nextInt scannerS String U = scannerS.next(); U scannerS.next() scannerS.next scannerS int a = A; a A int b = B; b B if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		} S.equals(U) S.equals S U {
			a = a - 1;
		} a = a - 1 a a - 1 a 1 if (T.equals(U)) {
			b = b - 1;
		} T.equals(U) T.equals T U {
			b = b - 1;
		} b = b - 1 b 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scannerS = new Scanner(System.in);
		String S = scannerS.next();
		String T = scannerS.next();
		int A = scannerS.nextInt();
		int B = scannerS.nextInt();
		String U = scannerS.next();

		int a = A;
		int b = B;

		if (S.equals(U)) {
			a = a - 1;
		} else if (T.equals(U)) {
			b = b - 1;
		}

		System.out.println(a + " " + b);
	}

}