import java.util.Scanner;

public class Main {


		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		}

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


		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		}

	} Main public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		} main {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		} 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 int a= A; a A int b= B; b B if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    } S.equals(U) S.equals S U {
		    	a = --a;
		    } a = --a a --a a {
		    	b = --b;
		    } b = --b b --b b System.out.println(a+" "+b) System.out.println System.out System System.out a+" "+b a+" "+b a " " b String[] args args public class Main {


		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		}

	} public class Main {


		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		}

	} Main
import java.util.Scanner;

public class Main {


		public static void main(String[] args) {
			// TODO 自動生成されたメソッド・スタブ
			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();
		    int a= A;
		    int b= B;

		    if(S.equals(U)) {
		    	a = --a;
		    }else{
		    	b = --b;
		    }
		    System.out.println(a+" "+b);
		}

	}