import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	}

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

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	}

} Main public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	} main {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	} Scanner kbs = new Scanner(System.in); kbs new Scanner(System.in) String S = kbs.next(); S kbs.next() kbs.next kbs String T = kbs.next(); T kbs.next() kbs.next kbs int A = kbs.nextInt(); A kbs.nextInt() kbs.nextInt kbs int B = kbs.nextInt(); B kbs.nextInt() kbs.nextInt kbs String U = kbs.next(); U kbs.next() kbs.next kbs if(U.equals(S)){
			A -= 1;
		} U.equals(S) U.equals U S {
			A -= 1;
		} A -= 1 A 1 if(U.equals(T)){
			B -= 1;
		} U.equals(T) U.equals U T {
			B -= 1;
		} B -= 1 B 1 System.out.printf("%d %d\n", A,B) System.out.printf System.out System System.out "%d %d\n" A B kbs.close() kbs.close kbs String[] args args public class Main {

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	}

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

	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		String S = kbs.next();
		String T = kbs.next();
		int A = kbs.nextInt();
		int B = kbs.nextInt();
		String U = kbs.next();
		if(U.equals(S)){
			A -= 1;
		}
		if(U.equals(T)){
			B -= 1;
		}
		System.out.printf("%d %d\n", A,B);
		kbs.close();
	}

}
