import java.util.Collections;
import java.util.Scanner;

public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    }




} import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    }




} Main // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    } main {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String splt[] = scanner.nextLine().split(" "); splt scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " String spltNum[] = scanner.nextLine().split(" "); spltNum scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " String throwU = scanner.nextLine(); throwU scanner.nextLine() scanner.nextLine scanner if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        } throwU.equals(splt[0]) throwU.equals throwU splt[0] splt 0 {
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        } System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]) System.out.println System.out System System.out Integer.parseInt(spltNum[0])-1 + " " + spltNum[1] Integer.parseInt(spltNum[0])-1 + " " + spltNum[1] Integer.parseInt(spltNum[0])-1 Integer.parseInt(spltNum[0]) Integer.parseInt Integer spltNum[0] spltNum 0 1 " " spltNum[1] spltNum 1 {
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        } System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) ) System.out.println System.out System System.out Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) Integer.parseInt(spltNum[0]) Integer.parseInt Integer spltNum[0] spltNum 0 " " (Integer.parseInt(spltNum[1]) - 1) Integer.parseInt(spltNum[1]) Integer.parseInt Integer spltNum[1] spltNum 1 1 String[] args args public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    }




} public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    }




} Main
import java.util.Collections;
import java.util.Scanner;

public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String splt[] = scanner.nextLine().split(" ");
        String spltNum[] = scanner.nextLine().split(" ");
        String throwU = scanner.nextLine();
        if(throwU.equals(splt[0])){
            System.out.println(Integer.parseInt(spltNum[0])-1 + " " + spltNum[1]);
        }else{
            System.out.println(Integer.parseInt(spltNum[0]) + " " + (Integer.parseInt(spltNum[1]) - 1) );
        }

    }




}
