import java.util.*;

/**
 * @author yamato
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	}

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

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	} main {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(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 if(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		} S.equals(U) S.equals S U {
			A = A-1;
		} A = A-1 A A-1 A 1 if(T.equals(U)){
			B = B-1;
		} T.equals(U) T.equals T U {
			B = B-1;
		} B = B-1 B B-1 B 1 System.out.print(A+" "+B) System.out.print System.out System System.out A+" "+B A+" "+B A " " B String[] args args public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	}

} public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	}

} Main
import java.util.*;

/**
 * @author yamato
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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(S.equals(U)) {
			A = A-1;
		}else if(T.equals(U)){
			B = B-1;
		}
		System.out.print(A+" "+B);
		
	}

}