import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     } main {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line = scanner.nextLine(); line scanner.nextLine() scanner.nextLine scanner String[] values = line.split(" "); values line.split(" ") line.split line " " String A = values[0]; A values[0] values 0 String B = values[1]; B values[1] values 1 line = scanner.nextLine() line scanner.nextLine() scanner.nextLine scanner values = line.split(" ") values line.split(" ") line.split line " " int AC = Integer.parseInt(values[0]); AC Integer.parseInt(values[0]) Integer.parseInt Integer values[0] values 0 int BC = Integer.parseInt(values[1]); BC Integer.parseInt(values[1]) Integer.parseInt Integer values[1] values 1 line = scanner.nextLine() line scanner.nextLine() scanner.nextLine scanner values = line.split(" ") values line.split(" ") line.split line " " String sute = values[0]; sute values[0] values 0 if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        } A.equals(sute) A.equals A sute {
            System.out.println((AC - 1) + " " + BC);
        } System.out.println((AC - 1) + " " + BC) System.out.println System.out System System.out (AC - 1) + " " + BC (AC - 1) + " " + BC (AC - 1) AC 1 " " BC if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        } B.equals(sute) B.equals B sute {
            System.out.println(AC + " " + (BC - 1));
        } System.out.println(AC + " " + (BC - 1)) System.out.println System.out System System.out AC + " " + (BC - 1) AC + " " + (BC - 1) AC " " (BC - 1) BC 1 {
            System.out.println(AC + " " + BC);
        } System.out.println(AC + " " + BC) System.out.println System.out System System.out AC + " " + BC AC + " " + BC AC " " BC String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");

        String A = values[0];
        String B = values[1];
        line = scanner.nextLine();
        values = line.split(" ");
        int AC = Integer.parseInt(values[0]);
        int BC = Integer.parseInt(values[1]);
        line = scanner.nextLine();
        values = line.split(" ");
        String sute = values[0];
        if (A.equals(sute)) {
            System.out.println((AC - 1) + " " + BC);
        } else if (B.equals(sute))  {
            System.out.println(AC + " " + (BC - 1));
        } else {
            System.out.println(AC + " " + BC);
        }
     }
}