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

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				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 {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

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

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			}
			System.out.println(a + " " + b);
		}
	} main {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			}
			System.out.println(a + " " + b);
		}
	} try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			}
			System.out.println(a + " " + b);
		} {

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			}
			System.out.println(a + " " + b);
		} BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in)) new BufferedReader(
				new InputStreamReader(System.in)) String in = br.readLine(); in br.readLine() br.readLine br String chr[] = in.split(" "); chr in.split(" ") in.split in " " String inp = br.readLine(); inp br.readLine() br.readLine br String chrp[] = inp.split(" "); chrp inp.split(" ") inp.split inp " " int a = Integer.parseInt(chrp[0]); a Integer.parseInt(chrp[0]) Integer.parseInt Integer chrp[0] chrp 0 int b = Integer.parseInt(chrp[1]); b Integer.parseInt(chrp[1]) Integer.parseInt Integer chrp[1] chrp 1 String u = br.readLine(); u br.readLine() br.readLine br if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			} chr[0].equals(u) chr[0].equals chr[0] chr 0 u {
				a--;
			} a-- a {
				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 {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

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

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				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 {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			String inp = br.readLine();
			String chrp[] = inp.split(" ");
			int a = Integer.parseInt(chrp[0]);
			int b = Integer.parseInt(chrp[1]);
			String u = br.readLine();
			if (chr[0].equals(u)) {
				a--;
			} else {
				b--;
			}
			System.out.println(a + " " + b);
		}
	}
}