import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    }
    System.out.println(A+" "+B);    
  }
} import java.util.Scanner; Scanner java.util import java.util.Comparator; Comparator java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    }
    System.out.println(A+" "+B);    
  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    }
    System.out.println(A+" "+B);    
  } main {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    }
    System.out.println(A+" "+B);    
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan String U = scan.next(); U scan.next() scan.next scan if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    } U.equals(S) U.equals U S {
      A = A - 1;
    } A = A - 1 A A - 1 A 1 {
      B = B - 1;
    } B = B - 1 B 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
import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();

    if (U.equals(S)) {
      A = A - 1;
    }
    else{
      B = B - 1;
    }
    System.out.println(A+" "+B);    
  }
}