import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    } main {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] ST = sc.nextLine().split(" "); ST sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String[] AB = sc.nextLine().split(" "); AB sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String U = sc.nextLine(); U sc.nextLine() sc.nextLine sc sc.close() sc.close sc String S = ST[0]; S ST[0] ST 0 String T = ST[1]; T ST[1] ST 1 int A = Integer.parseInt(AB[0]); A Integer.parseInt(AB[0]) Integer.parseInt Integer AB[0] AB 0 int B = Integer.parseInt(AB[1]); B Integer.parseInt(AB[1]) Integer.parseInt Integer AB[1] AB 1 if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        } U.equals(S) U.equals U S {
            A--;
        } A-- A if (U.equals(T)) {
            B--;
        } U.equals(T) U.equals U T {
            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 sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
}