import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] in = sc.nextLine().split(" "); in sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String s = in[0]; s in[0] in 0 String t = in[1]; t in[1] in 1 String[] in2 = sc.nextLine().split(" "); in2 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int a = Integer.valueOf(in2[0]); a Integer.valueOf(in2[0]) Integer.valueOf Integer in2[0] in2 0 int b = Integer.valueOf(in2[1]); b Integer.valueOf(in2[1]) Integer.valueOf Integer in2[1] in2 1 String u = sc.nextLine(); u sc.nextLine() sc.nextLine sc if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		} s.equals(u) s.equals s u {
			System.out.println((a - 1) + " " + b);
		} System.out.println((a - 1) + " " + b) System.out.println System.out System System.out (a - 1) + " " + b (a - 1) + " " + b (a - 1) a 1 " " b {
			System.out.println(a + " " + (b - 1));
		} System.out.println(a + " " + (b - 1)) System.out.println System.out System System.out a + " " + (b - 1) a + " " + (b - 1) a " " (b - 1) b 1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] in = sc.nextLine().split(" ");
		String s = in[0];
		String t = in[1];

		String[] in2 = sc.nextLine().split(" ");
		int a = Integer.valueOf(in2[0]);
		int b = Integer.valueOf(in2[1]);
		String u = sc.nextLine();
		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}
	}
}
