import java.util.Scanner;

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

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