import java.util.Scanner;

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

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  } main {
    Scanner scanner = new Scanner(System.in);

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if (U.equals(S)) A--;
    else B--; U.equals(S) U.equals U S A-- A B-- B System.out.printf("%d %d\n", A, B) System.out.printf System.out System System.out "%d %d\n" A B String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  }
} Main
import java.util.Scanner;

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

    String S = scanner.next();
    String T = scanner.next();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    String U = scanner.next();
    if (U.equals(S)) A--;
    else B--;
    System.out.printf("%d %d\n", A, B);
  }
}
