import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  }
} import java.util.*; util.* java public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  } main {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.next(); str1 sc.next() sc.next sc String str2 = sc.next(); str2 sc.next() sc.next sc int a1 = sc.nextInt(); a1 sc.nextInt() sc.nextInt sc int a2 = sc.nextInt(); a2 sc.nextInt() sc.nextInt sc String str = sc.next(); str sc.next() sc.next sc if (str.equals(str1)) {
      a1--;
    } str.equals(str1) str.equals str str1 {
      a1--;
    } a1-- a1 if (str.equals(str2)) {
      a2--;
    } str.equals(str2) str.equals str str2 {
      a2--;
    } a2-- a2 System.out.print(a1 + " " + a2) System.out.print System.out System System.out a1 + " " + a2 a1 + " " + a2 a1 " " a2 String[] args args public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  }
} public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  }
} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = sc.next();
    int a1 = sc.nextInt();
    int a2 = sc.nextInt();
    String str = sc.next();

    if (str.equals(str1)) {
      a1--;
    }
    if (str.equals(str2)) {
      a2--;
    }
    System.out.print(a1 + " " + a2);
    
  }
}
