import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] str = br.readLine().split(" ",0); str br.readLine().split(" ",0) br.readLine().split br.readLine() br.readLine br " " 0 String[] n = br.readLine().split(" ",0); n br.readLine().split(" ",0) br.readLine().split br.readLine() br.readLine br " " 0 int[] num = new int[2]; num new int[2] 2 num[0] = Integer.parseInt(n[0]) num[0] num 0 Integer.parseInt(n[0]) Integer.parseInt Integer n[0] n 0 num[1] = Integer.parseInt(n[1]) num[1] num 1 Integer.parseInt(n[1]) Integer.parseInt Integer n[1] n 1 String s = br.readLine(); s br.readLine() br.readLine br if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        } s.equals(str[0]) s.equals s str[0] str 0 {
            num[0]--;
        } num[0]-- num[0] num 0 {
            num[1]--;
        } num[1]-- num[1] num 1 System.out.println(num[0] + " " + num[1]) System.out.println System.out System System.out num[0] + " " + num[1] num[0] + " " + num[1] num[0] num 0 " " num[1] num 1 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ",0);
        String[] n = br.readLine().split(" ",0);
        int[] num = new int[2];
        num[0] = Integer.parseInt(n[0]);
        num[1] = Integer.parseInt(n[1]);
        String s = br.readLine();
        if(s.equals(str[0])){
            num[0]--;
        }else{
            num[1]--;
        }
        System.out.println(num[0] + " " + num[1]);
    }
}
