import java.io.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	}

} import java.io.*; io.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	} main {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	} try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		} catch (IOException e) {
			System.out.print(e);
		} IOException e {
			System.out.print(e);
		} System.out.print(e) System.out.print System.out System System.out e {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String line = new String(in.readLine()); line new String(in.readLine()) String[] input1 = new String[2]; input1 new String[2] 2 input1 = line.split(" ") input1 line.split(" ") line.split line " " line = new String(in.readLine()) line new String(in.readLine()) String[] input2 = new String[4]; input2 new String[4] 4 input2 = line.split(" ") input2 line.split(" ") line.split line " " int num2 = Integer.parseInt(input2[0].trim()); num2 Integer.parseInt(input2[0].trim()) Integer.parseInt Integer input2[0].trim() input2[0].trim input2[0] input2 0 int num3 = Integer.parseInt(input2[1].trim()); num3 Integer.parseInt(input2[1].trim()) Integer.parseInt Integer input2[1].trim() input2[1].trim input2[1] input2 1 line = new String(in.readLine()) line new String(in.readLine()) if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			} line.equals(input1[0]) line.equals line input1[0] input1 0 {//Sならば
				num2 = num2 - 1;
			} num2 = num2 - 1 num2 num2 - 1 num2 1 {
				num3 = num3 - 1;
			} num3 = num3 - 1 num3 num3 - 1 num3 1 System.out.println(num2 + " " + num3) System.out.println System.out System System.out num2 + " " + num3 num2 + " " + num3 num2 " " num3 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	}

} Main
import java.io.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input1 = new String[2];//空白ごとに値をスプリット
			input1 = line.split(" ");
			line = new String(in.readLine());
			String[] input2 = new String[4];//空白ごとに値をスプリット
			input2 = line.split(" ");
			int num2 = Integer.parseInt(input2[0].trim());
			int num3 = Integer.parseInt(input2[1].trim());
			line = new String(in.readLine());
			//System.out.println(input1[0] + input1[1] + input2[0] + input2[1] + " " + line);
			if(line.equals(input1[0])) {//Sならば
				num2 = num2 - 1;
			}else {
				num3 = num3 - 1;
			}
			System.out.println(num2 + " " + num3);
			
		} catch (IOException e) {
			System.out.print(e);
		}
	}

}
