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