import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	} main {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String colorA = sc.next(); colorA sc.next() sc.next sc String colorB = sc.next(); colorB sc.next() sc.next sc int numA = sc.nextInt(); numA sc.nextInt() sc.nextInt sc int numB = sc.nextInt(); numB sc.nextInt() sc.nextInt sc String colorC = sc.next(); colorC sc.next() sc.next sc if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		} colorC.equals(colorA) colorC.equals colorC colorA {
			numA--;
		} numA-- numA if (colorC.equals(colorB)) {
			numB--;
		} colorC.equals(colorB) colorC.equals colorC colorB {
			numB--;
		} numB-- numB System.out.println(numA + " " + numB) System.out.println System.out System System.out numA + " " + numB numA + " " + numB numA " " numB String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
}