import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

class Main {

    public static void main(String[] args) throws Exception {

        try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map; Map java.util class Main {

    public static void main(String[] args) throws Exception {

        try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
} Main public static void main(String[] args) throws Exception {

        try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } main {

        try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } IOException | NumberFormatException e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } final Exception e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) List<String> firstRow = Arrays.asList(br.readLine().split(" ")); firstRow Arrays.asList(br.readLine().split(" ")) Arrays.asList Arrays br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " List<String> secondRow = Arrays.asList(br.readLine().split(" ")); secondRow Arrays.asList(br.readLine().split(" ")) Arrays.asList Arrays br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String thirdRow = br.readLine(); thirdRow br.readLine() br.readLine br List<Integer> ballsCount = new ArrayList<>(); ballsCount new ArrayList<>() for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            } String s secondRow {
                ballsCount.add(Integer.parseInt(s));
            } {
                ballsCount.add(Integer.parseInt(s));
            } ballsCount.add(Integer.parseInt(s)) ballsCount.add ballsCount Integer.parseInt(s) Integer.parseInt Integer s Map<String, Integer> ballsCountAndColor = new HashMap<>(); ballsCountAndColor new HashMap<>() for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            } int i = 0; int i = 0; i 0 i < firstRow.size() i firstRow.size() firstRow.size firstRow i++ i++ i {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            } {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            } ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i)) ballsCountAndColor.put ballsCountAndColor firstRow.get(i) firstRow.get firstRow i ballsCount.get(i) ballsCount.get ballsCount i ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1) ballsCountAndColor.put ballsCountAndColor thirdRow ballsCountAndColor.get(thirdRow).intValue() - 1 ballsCountAndColor.get(thirdRow).intValue() ballsCountAndColor.get(thirdRow).intValue ballsCountAndColor.get(thirdRow) ballsCountAndColor.get ballsCountAndColor thirdRow 1 int iterator = 1; iterator 1 String result = ""; result "" for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            } int output ballsCountAndColor.values() ballsCountAndColor.values ballsCountAndColor {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            } {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            } if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                } iterator == 1 iterator 1 {
                    result = output + " ";
                    iterator++;
                } result = output + " " result output + " " output " " iterator++ iterator {
                    result += output;
                } result += output result output System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue()) System.out.print System.out System System.out ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue() ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue() ballsCountAndColor.get(firstRow.get(0)).intValue() ballsCountAndColor.get(firstRow.get(0)).intValue ballsCountAndColor.get(firstRow.get(0)) ballsCountAndColor.get ballsCountAndColor firstRow.get(0) firstRow.get firstRow 0 " " ballsCountAndColor.get(firstRow.get(1)).intValue() ballsCountAndColor.get(firstRow.get(1)).intValue ballsCountAndColor.get(firstRow.get(1)) ballsCountAndColor.get ballsCountAndColor firstRow.get(1) firstRow.get firstRow 1 String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

class Main {

    public static void main(String[] args) throws Exception {

        try {

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

            List<String> firstRow = Arrays.asList(br.readLine().split(" "));
            List<String> secondRow = Arrays.asList(br.readLine().split(" "));
            String thirdRow = br.readLine();

            List<Integer> ballsCount = new ArrayList<>();
            for (String s : secondRow) {
                ballsCount.add(Integer.parseInt(s));
            }

            Map<String, Integer> ballsCountAndColor = new HashMap<>();

            for (int i = 0; i < firstRow.size(); i++) {
                ballsCountAndColor.put(firstRow.get(i), ballsCount.get(i));
            }

            ballsCountAndColor.put(thirdRow, ballsCountAndColor.get(thirdRow).intValue() - 1);

            int iterator = 1;
            String result = "";
            for (int output : ballsCountAndColor.values()) {
                if (iterator == 1) {
                    result = output + " ";
                    iterator++;
                } else {
                    result += output;
                }

            }

            System.out.print(ballsCountAndColor.get(firstRow.get(0)).intValue() + " " + ballsCountAndColor.get(firstRow.get(1)).intValue());

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}