import java.util.Scanner;

public class Main {
	    public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        String S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(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 S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    }
} Main public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        String S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    } main {
	        Scanner scan = new Scanner(System.in);
	        String S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T 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 U = scan.next(); U scan.next() scan.next scan if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        } U.equals(S) U.equals U S {
	        	num1--;
	        } num1-- num1 if(U.equals(T)){
	         	num2--;
	        } U.equals(T) U.equals U T {
	         	num2--;
	        } num2-- num2 scan.close() scan.close scan System.out.print(num1 + " " + num2) System.out.print 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 S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    }
} public class Main {
	    public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        String S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    }
} Main
import java.util.Scanner;

public class Main {
	    public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        String S = scan.next();
	        String T = scan.next();
	        int num1 = scan.nextInt();
	        int num2 = scan.nextInt();
	        String U = scan.next();

	        if(U.equals(S)){
	        	num1--;
	        }else if(U.equals(T)){
	         	num2--;
	        }
	        scan.close();
	      	System.out.print(num1 + " " + num2);
    }
}
