import java.io.*;

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

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    }
} import java.io.*; io.* java public class Main {
    public static void main (String[] args) throws Exception {
        String s;

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    }
} Main public static void main (String[] args) throws Exception {
        String s;

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    } main {
        String s;

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    } String s; s BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in)); reader new BufferedReader (new InputStreamReader (System.in)) s = reader.readLine() s reader.readLine() reader.readLine reader String[] sl    = s.split (" "); sl s.split (" ") s.split s " " final String S = sl[0]; S sl[0] sl 0 final String T = sl[1]; T sl[1] sl 1 s     = reader.readLine() s reader.readLine() reader.readLine reader sl    = s.split (" ") sl s.split (" ") s.split s " " int A = Integer.parseInt (sl[0]); A Integer.parseInt (sl[0]) Integer.parseInt Integer sl[0] sl 0 int B = Integer.parseInt (sl[1]); B Integer.parseInt (sl[1]) Integer.parseInt Integer sl[1] sl 1 final 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 PrintWriter out = new PrintWriter (System.out); out new PrintWriter (System.out) out.println (A + " " + B) out.println out A + " " + B A + " " + B A " " B out.flush() out.flush out String[] args args public class Main {
    public static void main (String[] args) throws Exception {
        String s;

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    }
} public class Main {
    public static void main (String[] args) throws Exception {
        String s;

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    }
} Main
import java.io.*;

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

        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));

        s = reader.readLine();

        String[] sl    = s.split (" ");
        final String S = sl[0];
        final String T = sl[1];

        s     = reader.readLine();
        sl    = s.split (" ");
        int A = Integer.parseInt (sl[0]);
        int B = Integer.parseInt (sl[1]);

        final String U = reader.readLine();

        if (S.equals (U)) {
            A--;
        } else {
            B--;
        }

        PrintWriter out = new PrintWriter (System.out);
        out.println (A + " " + B);

        out.flush();
    }
}