import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    }
} Main public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); out new PrintWriter(new OutputStreamWriter(System.out)) String[] str = new String[2]; str new String[2] 2 str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String[] strNum = new String[2]; strNum new String[2] 2 strNum = br.readLine().split(" ") strNum br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] num = new int[2]; num new int[2] 2 num[0] = Integer.parseInt(strNum[0]) num[0] num 0 Integer.parseInt(strNum[0]) Integer.parseInt Integer strNum[0] strNum 0 num[1] = Integer.parseInt(strNum[1]) num[1] num 1 Integer.parseInt(strNum[1]) Integer.parseInt Integer strNum[1] strNum 1 String which = br.readLine(); which br.readLine() br.readLine br out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1)) out.println out str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1) str[0].equals(which) str[0].equals str[0] str 0 which (num[0] - 1) + " " + num[1] (num[0] - 1) + " " + num[1] (num[0] - 1) num[0] num 0 1 " " num[1] num 1 num[0] + " " + (num[1] - 1) num[0] + " " + (num[1] - 1) num[0] num 0 " " (num[1] - 1) num[1] num 1 1 out.close() out.close out String[] args args public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] str = new String[2];
        str = br.readLine().split(" ");
        
        String[] strNum = new String[2];
        strNum = br.readLine().split(" ");
        int[] num = new int[2];
        num[0] = Integer.parseInt(strNum[0]);
        num[1] = Integer.parseInt(strNum[1]);
        
        String which = br.readLine();
        
        out.println(str[0].equals(which) ? (num[0] - 1) + " " + num[1] : num[0] + " " + (num[1] - 1));
        out.close();
        
    }
}