import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    Map<String, Integer> map = new HashMap<>();
    map.put(s, sc.nextInt());
    map.put(t, sc.nextInt());
    String u = sc.next();
    map.put(u, map.get(u) - 1);
    StringBuilder sb = new StringBuilder();
    sb.append(map.get(s));
    sb.append(" ");
    sb.append(map.get(t));
    System.out.println(sb.toString());
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    Map<String, Integer> map = new HashMap<>();
    map.put(s, sc.nextInt());
    map.put(t, sc.nextInt());
    String u = sc.next();
    map.put(u, map.get(u) - 1);
    StringBuilder sb = new StringBuilder();
    sb.append(map.get(s));
    sb.append(" ");
    sb.append(map.get(t));
    System.out.println(sb.toString());
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    Map<String, Integer> map = new HashMap<>();
    map.put(s, sc.nextInt());
    map.put(t, sc.nextInt());
    String u = sc.next();
    map.put(u, map.get(u) - 1);
    StringBuilder sb = new StringBuilder();
    sb.append(map.get(s));
    sb.append(" ");
    sb.append(map.get(t));
    System.out.println(sb.toString());
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    Map<String, Integer> map = new HashMap<>();
    map.put(s, sc.nextInt());
    map.put(t, sc.nextInt());
    String u = sc.next();
    map.put(u, map.get(u) - 1);
    StringBuilder sb = new StringBuilder();
    sb.append(map.get(s));
    sb.append(" ");
    sb.append(map.get(t));
    System.out.println(sb.toString());
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc Map<String, Integer> map = new HashMap<>(); map new HashMap<>() map.put(s, sc.nextInt()) map.put map s sc.nextInt() sc.nextInt sc map.put(t, sc.nextInt()) map.put map t sc.nextInt() sc.nextInt sc String u = sc.next(); u sc.next() sc.next sc map.put(u, map.get(u) - 1) map.put map u map.get(u) - 1 map.get(u) map.get map u 1 StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(map.get(s)) sb.append sb map.get(s) map.get map s sb.append(" ") sb.append sb " " sb.append(map.get(t)) sb.append sb map.get(t) map.get map t System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    Map<String, Integer> map = new HashMap<>();
    map.put(s, sc.nextInt());
    map.put(t, sc.nextInt());
    String u = sc.next();
    map.put(u, map.get(u) - 1);
    StringBuilder sb = new StringBuilder();
    sb.append(map.get(s));
    sb.append(" ");
    sb.append(map.get(t));
    System.out.println(sb.toString());
  }
}