import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Map<String, Integer> map = new HashMap<>();
        String color1=sc.next();
        String color2=sc.next();
        map.put(color1, sc.nextInt());
        map.put(color2, sc.nextInt());
        String tmp=sc.next();
        map.put(tmp, map.get(tmp)-1);
        System.out.println(map.get(color1)+" "+map.get(color2));
        
    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Map<String, Integer> map = new HashMap<>();
        String color1=sc.next();
        String color2=sc.next();
        map.put(color1, sc.nextInt());
        map.put(color2, sc.nextInt());
        String tmp=sc.next();
        map.put(tmp, map.get(tmp)-1);
        System.out.println(map.get(color1)+" "+map.get(color2));
        
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Map<String, Integer> map = new HashMap<>();
        String color1=sc.next();
        String color2=sc.next();
        map.put(color1, sc.nextInt());
        map.put(color2, sc.nextInt());
        String tmp=sc.next();
        map.put(tmp, map.get(tmp)-1);
        System.out.println(map.get(color1)+" "+map.get(color2));
        
    } main {
        Scanner sc = new Scanner(System.in);
        Map<String, Integer> map = new HashMap<>();
        String color1=sc.next();
        String color2=sc.next();
        map.put(color1, sc.nextInt());
        map.put(color2, sc.nextInt());
        String tmp=sc.next();
        map.put(tmp, map.get(tmp)-1);
        System.out.println(map.get(color1)+" "+map.get(color2));
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Map<String, Integer> map = new HashMap<>(); map new HashMap<>() String color1=sc.next(); color1 sc.next() sc.next sc String color2=sc.next(); color2 sc.next() sc.next sc map.put(color1, sc.nextInt()) map.put map color1 sc.nextInt() sc.nextInt sc map.put(color2, sc.nextInt()) map.put map color2 sc.nextInt() sc.nextInt sc String tmp=sc.next(); tmp sc.next() sc.next sc map.put(tmp, map.get(tmp)-1) map.put map tmp map.get(tmp)-1 map.get(tmp) map.get map tmp 1 System.out.println(map.get(color1)+" "+map.get(color2)) System.out.println System.out System System.out map.get(color1)+" "+map.get(color2) map.get(color1)+" "+map.get(color2) map.get(color1) map.get map color1 " " map.get(color2) map.get map color2 String args[] args
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Map<String, Integer> map = new HashMap<>();
        String color1=sc.next();
        String color2=sc.next();
        map.put(color1, sc.nextInt());
        map.put(color2, sc.nextInt());
        String tmp=sc.next();
        map.put(tmp, map.get(tmp)-1);
        System.out.println(map.get(color1)+" "+map.get(color2));
        
    }
}
