import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	} main {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String x = sc.next(); x sc.next() sc.next sc String y = sc.next(); y sc.next() sc.next sc int z = sc.nextInt(); z sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String v = sc.next(); v sc.next() sc.next sc if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		} v.equals(x) v.equals v x {
			z = z - 1;
			System.out.println(z + " " + n);
		} z = z - 1 z z - 1 z 1 System.out.println(z + " " + n) System.out.println System.out System System.out z + " " + n z + " " + n z " " n if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		} v.equals(y) v.equals v y {
			n = n - 1;
			System.out.println(z + " " + n);

		} n = n - 1 n n - 1 n 1 System.out.println(z + " " + n) System.out.println System.out System System.out z + " " + n z + " " + n z " " n String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	}

} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int z = sc.nextInt();
		int n = sc.nextInt();
		String v = sc.next();
		if (v.equals(x)) {
			z = z - 1;
			System.out.println(z + " " + n);
		} else if (v.equals(y)) {
			n = n - 1;
			System.out.println(z + " " + n);

		}

	}

}
