import java.util.Scanner;

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

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    } main {
        Scanner sc = new Scanner(System.in);

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String color1 = sc.next(); color1 sc.next() sc.next sc sc.next() sc.next sc int color1Cnt = sc.nextInt(); color1Cnt sc.nextInt() sc.nextInt sc int color2Cnt = sc.nextInt(); color2Cnt sc.nextInt() sc.nextInt sc String disposed = sc.next(); disposed sc.next() sc.next sc if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        } disposed.equals(color1) disposed.equals disposed color1 {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        } System.out.printf("%d %d", color1Cnt - 1, color2Cnt) System.out.printf System.out System System.out "%d %d" color1Cnt - 1 color1Cnt 1 color2Cnt return; System.out.printf("%d %d", color1Cnt, color2Cnt - 1) System.out.printf System.out System System.out "%d %d" color1Cnt color2Cnt - 1 color2Cnt 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    }
} Main
import java.util.Scanner;

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

        String color1 = sc.next();
        sc.next();
        int color1Cnt = sc.nextInt();
        int color2Cnt = sc.nextInt();
        String disposed = sc.next();

        if (disposed.equals(color1)) {
            System.out.printf("%d %d", color1Cnt - 1, color2Cnt);
            return;
        }
        System.out.printf("%d %d", color1Cnt, color2Cnt - 1);
    }
}