
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
static Scanner sc = new Scanner(System.in);
static ArrayList<String> strList = new ArrayList<String>();
static ArrayList<String> intList2 = new ArrayList<String>();
public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
static Scanner sc = new Scanner(System.in);
static ArrayList<String> strList = new ArrayList<String>();
static ArrayList<String> intList2 = new ArrayList<String>();
public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	}

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static ArrayList<String> strList = new ArrayList<String>(); strList new ArrayList<String>() static ArrayList<String> intList2 = new ArrayList<String>(); intList2 new ArrayList<String>() public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	} main {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	} String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] strArray = str.split(" "); strArray str.split(" ") str.split str " " String str0 = strArray[0]; str0 strArray[0] strArray 0 String str1 = strArray[1]; str1 strArray[1] strArray 1 String strNum = sc.nextLine(); strNum sc.nextLine() sc.nextLine sc String[] intArray = strNum.split(" "); intArray strNum.split(" ") strNum.split strNum " " int num1 = Integer.parseInt(intArray[0]); num1 Integer.parseInt(intArray[0]) Integer.parseInt Integer intArray[0] intArray 0 int num2 = Integer.parseInt(intArray[1]); num2 Integer.parseInt(intArray[1]) Integer.parseInt Integer intArray[1] intArray 1 String strans = sc.nextLine(); strans sc.nextLine() sc.nextLine sc if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        } strans.equals(str0) strans.equals strans str0 {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        } System.out.print(num1-1 + " ") System.out.print System.out System System.out num1-1 + " " num1-1 num1 1 " " System.out.print(num2) System.out.print System.out System System.out num2 {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        } System.out.print(num1 + " ") System.out.print System.out System System.out num1 + " " num1 " " System.out.print(num2 - 1) System.out.print System.out System System.out num2 - 1 num2 1 String[] args args public class Main {
static Scanner sc = new Scanner(System.in);
static ArrayList<String> strList = new ArrayList<String>();
static ArrayList<String> intList2 = new ArrayList<String>();
public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	}

} public class Main {
static Scanner sc = new Scanner(System.in);
static ArrayList<String> strList = new ArrayList<String>();
static ArrayList<String> intList2 = new ArrayList<String>();
public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	}

} Main

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
static Scanner sc = new Scanner(System.in);
static ArrayList<String> strList = new ArrayList<String>();
static ArrayList<String> intList2 = new ArrayList<String>();
public static void main(String[] args) {

        String str = sc.nextLine();
        String[] strArray = str.split(" ");

        String str0 = strArray[0];
        String str1 = strArray[1];

        String strNum = sc.nextLine();
        String[] intArray = strNum.split(" ");

        int num1 = Integer.parseInt(intArray[0]);
        int num2 = Integer.parseInt(intArray[1]);

        String strans = sc.nextLine();

        if(strans.equals(str0)) {
        	System.out.print(num1-1 + " ");
        	System.out.print(num2);
        }
        else {
        	System.out.print(num1 + " ");
        	System.out.print(num2 - 1);
        }


	}

}
