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