import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();

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

        System.out.println(A + " " + B);
    }
} import java.util.*; util.* java class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();

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

        System.out.println(A + " " + B);
    }
} Main public static void main(String args[]) throws Exception{
        Main main = new Main();
    } main {
        Main main = new Main();
    } Main main = new Main(); main new Main() String args[] args public Main(){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();

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

        System.out.println(A + " " + B);
    } Main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();

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

        System.out.println(A + " " + B);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int A = Integer.parseInt(scanner.next()); A Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int B = Integer.parseInt(scanner.next()); B Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner String U = scanner.next(); U scanner.next() scanner.next scanner 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
import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String U = scanner.next();

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

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