import java.util.Scanner;
 
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();
	
		if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		}

	}
    
} import java.util.Scanner; Scanner java.util 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();
	
		if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		}

	}
    
} 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();
	
		if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		}

	} 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();
	
		if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		}

	} 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 if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		} S.equals(U) S.equals S U {
			A--;
			System.out.print( A +" "+ B);
		} A-- A System.out.print( A +" "+ B) System.out.print System.out System System.out A +" "+ B A +" "+ B A " " B if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		} T.equals(U) T.equals T U {
			B--;
			System.out.print( A +" "+ B);
		} B-- B System.out.print( A +" "+ B) System.out.print System.out System System.out A +" "+ B A +" "+ B A " " B String[] args args
import java.util.Scanner;
 
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();
	
		if( S.equals(U)){
			A--;
			System.out.print( A +" "+ B);
		}else if (T.equals(U)){
			B--;
			System.out.print( A +" "+ B);
		}

	}
    
}