import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

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

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

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

} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

            System.out.println(a + " " + b);
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

            System.out.println(a + " " + b);
        }
    } try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

            System.out.println(a + " " + b);
        } {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

            System.out.println(a + " " + b);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) 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 A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc int a = S.equals(U) ? --A : A; a S.equals(U) ? --A : A S.equals(U) S.equals S U --A A A int b = T.equals(U) ? --B : B; b T.equals(U) ? --B : B T.equals(U) T.equals 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) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

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

} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

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

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();
            int A = sc.nextInt();
            int B = sc.nextInt();
            String U = sc.next();

            int a = S.equals(U) ? --A : A;
            int b = T.equals(U) ? --B : B;

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

}