import java.util.Scanner;

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

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int countS = sc.nextInt(); countS sc.nextInt() sc.nextInt sc int countT = sc.nextInt(); countT sc.nextInt() sc.nextInt sc String take = sc.next(); take sc.next() sc.next sc if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        } take.equals(S) take.equals take S {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } countS-- countS System.out.printf("%d %d", countS, countT) System.out.printf System.out System System.out "%d %d" countS countT if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        } take.equals(T) take.equals take T {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } countT-- countT System.out.printf("%d %d", countS, countT) System.out.printf System.out System System.out "%d %d" countS countT {
            // 何もしない
        } String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
} Main
import java.util.Scanner;

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

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
}