
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    } main {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if (U.equals(S)) A -= 1; U.equals(S) U.equals U S A -= 1 A 1 if (U.equals(T)) B -= 1; U.equals(T) U.equals U T B -= 1 B 1 System.out.printf("%d %d%n", A, B) System.out.printf System.out System System.out "%d %d%n" A B String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    }
} Main

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();

        if (U.equals(S)) A -= 1;
        if (U.equals(T)) B -= 1;

        System.out.printf("%d %d%n", A, B);
    }
}
