import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] data1 = (sc.nextLine()).split(" "); data1 (sc.nextLine()).split(" ") (sc.nextLine()).split (sc.nextLine()) sc.nextLine sc " " String[] data2 = (sc.nextLine()).split(" "); data2 (sc.nextLine()).split(" ") (sc.nextLine()).split (sc.nextLine()) sc.nextLine sc " " int n1 = Integer.parseInt(data2[0]); n1 Integer.parseInt(data2[0]) Integer.parseInt Integer data2[0] data2 0 int n2 = Integer.parseInt(data2[1]); n2 Integer.parseInt(data2[1]) Integer.parseInt Integer data2[1] data2 1 String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        } str.equals(data1[0]) str.equals str data1[0] data1 0 {
            n1--;
        } n1-- n1 {
            n2--;
        } n2-- n2 System.out.println(n1 + " " + n2) System.out.println System.out System System.out n1 + " " + n2 n1 + " " + n2 n1 " " n2 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] data1 = (sc.nextLine()).split(" ");
        String[] data2 = (sc.nextLine()).split(" ");
        int n1 = Integer.parseInt(data2[0]);
        int n2 = Integer.parseInt(data2[1]);
        String str = sc.nextLine();
        if(str.equals(data1[0])){
            n1--;
        } else {
            n2--;
        }
        System.out.println(n1 + " " + n2);
    }
}
