import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    } main {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc String c = sc.next(); c sc.next() sc.next sc HashMap<String, Integer> map = new HashMap<>(); map new HashMap<>() map.put(a, x) map.put map a x map.put(b, y) map.put map b y map.put(c, map.get(c) - 1) map.put map c map.get(c) - 1 map.get(c) map.get map c 1 System.out.println(map.get(a) + " " + map.get(b)) System.out.println System.out System System.out map.get(a) + " " + map.get(b) map.get(a) + " " + map.get(b) map.get(a) map.get map a " " map.get(b) map.get map b String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int x = sc.nextInt();
        int y = sc.nextInt();
        String c = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(a, x);
        map.put(b, y);
        map.put(c, map.get(c) - 1);
        
        System.out.println(map.get(a) + " " + map.get(b));
    }
}
