import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String first = scanner.next(); first scanner.next() scanner.next scanner String second = scanner.next(); second scanner.next() scanner.next scanner int firstInt = scanner.nextInt(); firstInt scanner.nextInt() scanner.nextInt scanner int secondInt = scanner.nextInt(); secondInt scanner.nextInt() scanner.nextInt scanner String decision = scanner.next(); decision scanner.next() scanner.next scanner if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        } decision.equals(first) decision.equals decision first {
            System.out.println((firstInt - 1) + " " + secondInt);
        } System.out.println((firstInt - 1) + " " + secondInt) System.out.println System.out System System.out (firstInt - 1) + " " + secondInt (firstInt - 1) + " " + secondInt (firstInt - 1) firstInt 1 " " secondInt {
            System.out.println(firstInt + " " + (secondInt - 1));
        } System.out.println(firstInt + " " + (secondInt - 1)) System.out.println System.out System System.out firstInt + " " + (secondInt - 1) firstInt + " " + (secondInt - 1) firstInt " " (secondInt - 1) secondInt 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
}
