import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author varunvats32
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ARemainingBalls solver = new ARemainingBalls(); solver new ARemainingBalls() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    } ARemainingBalls public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        } solve {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        } String l = in.nextLine(); l in.nextLine() in.nextLine in String[] balls = l.split(" "); balls l.split(" ") l.split l " " String n = in.nextLine(); n in.nextLine() in.nextLine in String[] nums = n.split(" "); nums n.split(" ") n.split n " " String u = in.nextLine(); u in.nextLine() in.nextLine in int s = Integer.parseInt(nums[0]); s Integer.parseInt(nums[0]) Integer.parseInt Integer nums[0] nums 0 int t = Integer.parseInt(nums[1]); t Integer.parseInt(nums[1]) Integer.parseInt Integer nums[1] nums 1 if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            } u.equals(balls[0]) u.equals u balls[0] balls 0 {
                s--;
            } s-- s {
                t--;
            } t-- t out.println(s + " " + t) out.println out s + " " + t s + " " + t s " " t int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author varunvats32
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String l = in.nextLine();
            String[] balls = l.split(" ");
            String n = in.nextLine();
            String[] nums = n.split(" ");
            String u = in.nextLine();

            int s = Integer.parseInt(nums[0]);
            int t = Integer.parseInt(nums[1]);

            if (u.equals(balls[0])) {
                s--;
            } else {
                t--;
            }

            out.println(s + " " + t);
        }

    }
}

