import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    }

} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    } main {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line1 = scanner.nextLine(); line1 scanner.nextLine() scanner.nextLine scanner String ball_color_s = line1.split(" ")[0]; ball_color_s line1.split(" ")[0] line1.split(" ") line1.split line1 " " 0 String ball_color_t = line1.split(" ")[1]; ball_color_t line1.split(" ")[1] line1.split(" ") line1.split line1 " " 1 String line2 = scanner.nextLine(); line2 scanner.nextLine() scanner.nextLine scanner String ball_num_s = line2.split(" ")[0]; ball_num_s line2.split(" ")[0] line2.split(" ") line2.split line2 " " 0 String ball_num_t = line2.split(" ")[1]; ball_num_t line2.split(" ")[1] line2.split(" ") line2.split line2 " " 1 String ball_collor_u = scanner.nextLine(); ball_collor_u scanner.nextLine() scanner.nextLine scanner Map<String, Integer> ball_map = new HashMap<>(); ball_map new HashMap<>() ball_map.put(ball_color_s, Integer.valueOf(ball_num_s)) ball_map.put ball_map ball_color_s Integer.valueOf(ball_num_s) Integer.valueOf Integer ball_num_s ball_map.put(ball_color_t, Integer.valueOf(ball_num_t)) ball_map.put ball_map ball_color_t Integer.valueOf(ball_num_t) Integer.valueOf Integer ball_num_t ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1) ball_map.put ball_map ball_collor_u ball_map.get(ball_collor_u) - 1 ball_map.get(ball_collor_u) ball_map.get ball_map ball_collor_u 1 System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t)) System.out.println System.out System System.out ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t) ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t) ball_map.get(ball_color_s) ball_map.get ball_map ball_color_s " " ball_map.get(ball_color_t) ball_map.get ball_map ball_color_t String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    }

} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    }

} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String line1 = scanner.nextLine();
        String ball_color_s = line1.split(" ")[0];
        String ball_color_t = line1.split(" ")[1];

        String line2 = scanner.nextLine();
        String ball_num_s = line2.split(" ")[0];
        String ball_num_t = line2.split(" ")[1];

        String ball_collor_u = scanner.nextLine();

        Map<String, Integer> ball_map = new HashMap<>();
        ball_map.put(ball_color_s, Integer.valueOf(ball_num_s));
        ball_map.put(ball_color_t, Integer.valueOf(ball_num_t));
        ball_map.put(ball_collor_u, ball_map.get(ball_collor_u) - 1);

        System.out.println(ball_map.get(ball_color_s) + " " + ball_map.get(ball_color_t));
    }

}