import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1)) System.out.println System.out System System.out sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1) sc.next().equals(S) sc.next().equals sc.next() sc.next sc S A-1 + " " + B A-1 + " " + B A-1 A 1 " " B A + " " + (B-1) A + " " + (B-1) A " " (B-1) B 1 sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(sc.next().equals(S)? A-1 + " " + B : A + " " + (B-1));
		
		sc.close();
	}
}
