import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
} import java.io.*; io.* java public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    } main {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    } BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in)); reader new BufferedReader (new InputStreamReader (System.in)) String[] arr = reader.readLine().split (" "); arr reader.readLine().split (" ") reader.readLine().split reader.readLine() reader.readLine reader " " String S = arr[0]; S arr[0] arr 0 String T = arr[1]; T arr[1] arr 1 arr = reader.readLine().split (" ") arr reader.readLine().split (" ") reader.readLine().split reader.readLine() reader.readLine reader " " int A = Integer.parseInt (arr[0]); A Integer.parseInt (arr[0]) Integer.parseInt Integer arr[0] arr 0 int B = Integer.parseInt (arr[1]); B Integer.parseInt (arr[1]) Integer.parseInt Integer arr[1] arr 1 String U = reader.readLine(); U reader.readLine() reader.readLine reader if (S.equals(U)) {
            A--;
        } else {
            B--;
        } S.equals(U) S.equals S U {
            A--;
        } A-- A {
            B--;
        } B-- B System.out.println (A + " " + B) System.out.println System.out System System.out A + " " + B A + " " + B A " " B String[] args args public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
} public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
} Main
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
}