import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  }
} Main public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  } main {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  } Scanner sc = new java.util.Scanner(System.in); sc new java.util.Scanner(System.in) String[] st = sc.nextLine().split(" "); st sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String S = st[0]; S st[0] st 0 String T = st[1]; T st[1] st 1 String[] times = sc.nextLine().split(" "); times sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int A = Integer.parseInt(times[0]); A Integer.parseInt(times[0]) Integer.parseInt Integer times[0] times 0 int B = Integer.parseInt(times[1]); B Integer.parseInt(times[1]) Integer.parseInt Integer times[1] times 1 String U = sc.nextLine(); U sc.nextLine() sc.nextLine sc if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    } S.equals(U) S.equals S U {
      A -= 1;
    } A -= 1 A 1 if (T.equals(U)) {
      B -= 1;
    } T.equals(U) T.equals T U {
      B -= 1;
    } B -= 1 B 1 System.out.println(A + " " + B) System.out.println System.out System System.out A + " " + B A + " " + B A " " B String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    String[] st = sc.nextLine().split(" ");
    String S = st[0];
    String T = st[1];
    String[] times = sc.nextLine().split(" ");
    int A = Integer.parseInt(times[0]);
    int B = Integer.parseInt(times[1]);
    String U = sc.nextLine();
    if (S.equals(U)) {
      A -= 1;
    } else if (T.equals(U)) {
      B -= 1;
    }
    System.out.println(A + " " + B);
  }
}
