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

public class Main {

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

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  }
} 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 sc = new Scanner(System.in);

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

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

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  } 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 int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc Map<String , Integer> map = new HashMap<>(); map new HashMap<>() map.put(S, A) map.put map S A map.put(T, B) map.put map T B map.put(U, map.get(U) - 1) map.put map U map.get(U) - 1 map.get(U) map.get map U 1 System.out.println(map.get(S) + " " + map.get(T)) System.out.println System.out System System.out map.get(S) + " " + map.get(T) map.get(S) + " " + map.get(T) map.get(S) map.get map S " " map.get(T) map.get map T sc.close() sc.close sc String[] args args public class Main {

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

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  }
} public class Main {

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

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();

    Map<String , Integer> map = new HashMap<>();

    map.put(S, A);
    map.put(T, B);

    map.put(U, map.get(U) - 1);

    System.out.println(map.get(S) + " " + map.get(T));

    sc.close();
  }
}