import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	}


} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	}


} Main public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String W = in.readLine(); W in.readLine() in.readLine in String[] Ws = W.split(" "); Ws W.split(" ") W.split W " " W = in.readLine() W in.readLine() in.readLine in String[] Ws2 = W.split(" "); Ws2 W.split(" ") W.split W " " int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])}; A {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])} Integer.parseInt(Ws2[0]) Integer.parseInt Integer Ws2[0] Ws2 0 Integer.parseInt(Ws2[1]) Integer.parseInt Integer Ws2[1] Ws2 1 W = in.readLine() W in.readLine() in.readLine in if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		} W.equals(Ws[0]) W.equals W Ws[0] Ws 0 {
			A[0]--;
		} A[0]-- A[0] A 0 {
			A[1]--;
		} A[1]-- A[1] A 1 System.out.println(A[0]+" "+A[1]) System.out.println System.out System System.out A[0]+" "+A[1] A[0]+" "+A[1] A[0] A 0 " " A[1] A 1 String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	}


} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	}


} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		W = in.readLine();
		String[] Ws2 = W.split(" ");
		int[] A = {Integer.parseInt(Ws2[0]),Integer.parseInt(Ws2[1])};
		W = in.readLine();

		if(W.equals(Ws[0])){
			A[0]--;
		}else{
			A[1]--;
		}

		System.out.println(A[0]+" "+A[1]);

	}


}
