import java.util.*;

public class Main {
  	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    }

}
 import java.util.*; util.* java public class Main {
  	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    }

} Main public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    } main {

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	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 if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    } U.equals(T) U.equals U T {
	    	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 scanner.close() scanner.close scanner String[] args args public class Main {
  	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    }

} public class Main {
  	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    }

} Main
import java.util.*;

public class Main {
  	public static void main(String[] args){

		Scanner scanner = new Scanner(System.in);
		
	    String S = scanner.next();

	    String T = scanner.next();

		int a = scanner.nextInt();
		int b = scanner.nextInt();
	    String U = scanner.next();
 if(U.equals(S)) {
	    	System.out.println((a-1)+" "+b);
	    }else if(U.equals(T)) {
	    	System.out.println(a+" "+(b-1));
	    }
	  		scanner.close();
    }

}

