
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.next(); str1 sc.next() sc.next sc String str2 = sc.next(); str2 sc.next() sc.next sc int num1 = sc.nextInt(); num1 sc.nextInt() sc.nextInt sc int num2 = sc.nextInt(); num2 sc.nextInt() sc.nextInt sc String str3 = sc.next(); str3 sc.next() sc.next sc if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		} str3.equals(str1) str3.equals str3 str1 {
			System.out.println((num1-1) + " " + num2);
		} System.out.println((num1-1) + " " + num2) System.out.println System.out System System.out (num1-1) + " " + num2 (num1-1) + " " + num2 (num1-1) num1 1 " " num2 {
			System.out.println(num1 + " " + (num2-1));
		} System.out.println(num1 + " " + (num2-1)) System.out.println System.out System System.out num1 + " " + (num2-1) num1 + " " + (num2-1) num1 " " (num2-1) num2 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		String str3 = sc.next();
		if(str3.equals(str1)) {
			System.out.println((num1-1) + " " + num2);
		}else {
			System.out.println(num1 + " " + (num2-1));
		}
	}

}
