import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  } main {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  } Scanner sc = new Scanner (System.in); sc new Scanner (System.in) String s1=  sc.next(); s1 sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc int v1 = sc.nextInt(); v1 sc.nextInt() sc.nextInt sc int v2 = sc.nextInt(); v2 sc.nextInt() sc.nextInt sc String result = sc.next(); result sc.next() sc.next sc if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    } s1.equals(result) s1.equals s1 result {
      v1--;
      System.out.println(v1 + " " + v2);
    } v1-- v1 System.out.println(v1 + " " + v2) System.out.println System.out System System.out v1 + " " + v2 v1 + " " + v2 v1 " " v2 {
      v2--;
      System.out.println(v1 + " " + v2);
    } v2-- v2 System.out.println(v1 + " " + v2) System.out.println System.out System System.out v1 + " " + v2 v1 + " " + v2 v1 " " v2 String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner (System.in);
    String s1=  sc.next();
    String s2 = sc.next();
    int v1 = sc.nextInt();
    int v2 = sc.nextInt();
    String result = sc.next();
    if (s1.equals(result)) {
      v1--;
      System.out.println(v1 + " " + v2);
    }
    else {
      v2--;
      System.out.println(v1 + " " + v2);
    }
  }
}