import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    } 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 scanner.nextLine() scanner.nextLine scanner int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner scanner.nextLine() scanner.nextLine scanner String u = scanner.next(); u scanner.next() scanner.next scanner if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        } s.equals(u) s.equals s u {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b)) System.out.println System.out System System.out String.valueOf(a - 1) + ' ' + String.valueOf(b) String.valueOf(a - 1) + ' ' + String.valueOf(b) String.valueOf(a - 1) String.valueOf String a - 1 a 1 ' ' String.valueOf(b) String.valueOf String b if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        } t.equals(u) t.equals t u {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        } System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1)) System.out.println System.out System System.out String.valueOf(a) + ' ' + String.valueOf(b - 1) String.valueOf(a) + ' ' + String.valueOf(b - 1) String.valueOf(a) String.valueOf String a ' ' String.valueOf(b - 1) String.valueOf String b - 1 b 1 String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        scanner.nextLine();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        scanner.nextLine();
        String u = scanner.next();
        if (s.equals(u)) {
            System.out.println(String.valueOf(a - 1) + ' ' + String.valueOf(b));
        } else if (t.equals(u)) {
            System.out.println(String.valueOf(a) + ' ' + String.valueOf(b - 1));
        }
    }
}
