import java.util.*;
public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
} Main public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    } main {
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String color1 = sc.next(); color1 sc.next() sc.next sc final String color2 = sc.next(); color2 sc.next() sc.next sc int color1_n = sc.nextInt(); color1_n sc.nextInt() sc.nextInt sc int color2_n = sc.nextInt(); color2_n sc.nextInt() sc.nextInt sc final String target = sc.next(); target sc.next() sc.next sc if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        } target.equals(color1) target.equals target color1 {
            color1_n--;
        } color1_n-- color1_n if(target.equals(color2)){
            color2_n--;
        } target.equals(color2) target.equals target color2 {
            color2_n--;
        } color2_n-- color2_n System.out.println(color1_n + " " + color2_n) System.out.println System.out System System.out color1_n + " " + color2_n color1_n + " " + color2_n color1_n " " color2_n sc.close() sc.close sc final String[] args args public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
} public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
} Main
import java.util.*;
public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
}