import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] colors = sc.nextLine().split(" "); colors sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String throwAway = sc.nextLine().trim(); throwAway sc.nextLine().trim() sc.nextLine().trim sc.nextLine() sc.nextLine sc if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        } throwAway.equals(colors[0].trim()) throwAway.equals throwAway colors[0].trim() colors[0].trim colors[0] colors 0 {
            a--;
        } a-- a {
            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[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] colors = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.nextLine();
        String throwAway = sc.nextLine().trim();

        if (throwAway.equals(colors[0].trim())) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);
    }
}