import java.util.Scanner;

// A - Remaining Balls
// https://atcoder.jp/contests/abc154/tasks/abc154_a
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 = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(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 = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(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 = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(A + " " + B);
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(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 = Integer.parseInt(scanner.next()); A Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int B = Integer.parseInt(scanner.next()); B Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner String U = scanner.next(); U scanner.next() scanner.next scanner scanner.close() scanner.close scanner if (S.contains(U)) {
            A--;
        } S.contains(U) S.contains S U {
            A--;
        } A-- A if (T.contains(U)) {
            B--;
        } T.contains(U) T.contains T U {
            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) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(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 = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(A + " " + B);
    }
} Main
import java.util.Scanner;

// A - Remaining Balls
// https://atcoder.jp/contests/abc154/tasks/abc154_a
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 = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();
        scanner.close();

        if (S.contains(U)) {
            A--;
        }
        if (T.contains(U)) {
            B--;
        }
        System.out.println(A + " " + B);
    }
}
