import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next().intern();
        final String T = sc.next().intern();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final String U = sc.next().intern();
        if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1);
    }
}

public class Main {
    public static void main(String... args) {
        A.main();
    }
} import java.util.Scanner; Scanner java.util class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next().intern();
        final String T = sc.next().intern();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final String U = sc.next().intern();
        if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1);
    }
} A public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next().intern();
        final String T = sc.next().intern();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final String U = sc.next().intern();
        if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1);
    } main {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next().intern();
        final String T = sc.next().intern();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final String U = sc.next().intern();
        if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1);
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String S = sc.next().intern(); S sc.next().intern() sc.next().intern sc.next() sc.next sc final String T = sc.next().intern(); T sc.next().intern() sc.next().intern sc.next() sc.next sc final int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc final int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc final String U = sc.next().intern(); U sc.next().intern() sc.next().intern sc.next() sc.next sc if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1); S == U S U System.out.printf("%d %d\n", A - 1, B) System.out.printf System.out System System.out "%d %d\n" A - 1 A 1 B System.out.printf("%d %d\n", A, B - 1) System.out.printf System.out System System.out "%d %d\n" A B - 1 B 1 String... args args public class Main {
    public static void main(String... args) {
        A.main();
    }
} Main public static void main(String... args) {
        A.main();
    } main {
        A.main();
    } A.main() A.main A String... args args public class Main {
    public static void main(String... args) {
        A.main();
    }
} public class Main {
    public static void main(String... args) {
        A.main();
    }
} Main
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next().intern();
        final String T = sc.next().intern();
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final String U = sc.next().intern();
        if (S == U)
            System.out.printf("%d %d\n", A - 1, B);
        else
            System.out.printf("%d %d\n", A, B - 1);
    }
}

public class Main {
    public static void main(String... args) {
        A.main();
    }
}
