import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }


    static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    }


    static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }


    static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    }


    static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    }
} Main public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    } main {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    } OutputStream outputStream = System.out; outputStream System.out System System.out FastReader in = new FastReader(); in new FastReader() PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Solver solver = new Solver(); solver new Solver() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    } Solver public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        } solve {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        } String s = in.next() s in.next() in.next in t = in.next(); t in.next() in.next in int a = in.nextInt() a in.nextInt() in.nextInt in b = in.nextInt(); b in.nextInt() in.nextInt in String u = in.next(); u in.next() in.next in out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b) out.print out s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b s.equals(u) s.equals s u (a - 1) + " " + b (a - 1) + " " + b (a - 1) a 1 " " b t.equals(u) ? a + " " + (b - 1) : a + " " + b t.equals(u) t.equals t u a + " " + (b - 1) a + " " + (b - 1) a " " (b - 1) b 1 a + " " + b a + " " + b a " " b int testNumber testNumber FastReader in in PrintWriter out out static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        } FastReader {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        } br = new BufferedReader(new
                    InputStreamReader(System.in)) br new BufferedReader(new
                    InputStreamReader(System.in)) String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } nextLine {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } String str = ""; str "" try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                str = br.readLine();
            } str = br.readLine() str br.readLine() br.readLine br return str; str @Override
        public void close() throws Exception {

        } close {

        } AutoCloseable public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }


    static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    }


    static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }


    static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    }


    static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(1, in, out);
        out.close();
    }


    static class Solver {

        public void solve(int testNumber, FastReader in, PrintWriter out) throws IOException {
            String s = in.next(), t = in.next();
            int a = in.nextInt(), b = in.nextInt();
            String u = in.next();

            out.print(s.equals(u) ? (a - 1) + " " + b : t.equals(u) ? a + " " + (b - 1) : a + " " + b);
        }

    }


    static class FastReader implements AutoCloseable {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        @Override
        public void close() throws Exception {

        }
    }
}