import java.util.Scanner;

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

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