import java.util.*;

public class Main {

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

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
} import java.util.*; util.* java public class Main {

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

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
} Main public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String S = stdIn.next();
        String T = stdIn.next();
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        String U = stdIn.next();
        stdIn.close();

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    } main {
        Scanner stdIn = new Scanner(System.in);
        String S = stdIn.next();
        String T = stdIn.next();
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        String U = stdIn.next();
        stdIn.close();

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String S = stdIn.next(); S stdIn.next() stdIn.next stdIn String T = stdIn.next(); T stdIn.next() stdIn.next stdIn int A = stdIn.nextInt(); A stdIn.nextInt() stdIn.nextInt stdIn int B = stdIn.nextInt(); B stdIn.nextInt() stdIn.nextInt stdIn String U = stdIn.next(); U stdIn.next() stdIn.next stdIn stdIn.close() stdIn.close stdIn if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        } U.equals(S) U.equals U S {
            A += -1;
        } A += -1 A -1 1 if (U.equals(T)){
            B += -1;
        } U.equals(T) U.equals U T {
            B += -1;
        } B += -1 B -1 1 System.out.printf("%d %d", A, B) System.out.printf System.out System System.out "%d %d" A B String[] args args public class Main {

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

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
} public class Main {

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

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
} Main
import java.util.*;

public class Main {

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

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
}