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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	}

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

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String s = line[0]; s line[0] line 0 String t = line[1]; t line[1] line 1 line = br.readLine().split(" ") line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = Integer.parseInt(line[0]); a Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int b = Integer.parseInt(line[1]); b Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 String u = br.readLine(); u br.readLine() br.readLine br br.close() br.close br if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		} u.equals(s) u.equals u s {
			a--;
		} a-- a if(u.equals(t)) {
			b--;
		} u.equals(t) u.equals u t {
			b--;
		} b-- b System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	}

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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		String s = line[0];
		String t = line[1];
		line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String u = br.readLine();
		br.close();
		if(u.equals(s)) {
			a--;
		}else if(u.equals(t)) {
			b--;
		}
		System.out.println(a + " " + b);
	}

}
