import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String word1 = sc.next();
    String word2 = sc.next();
    int word1Cnt = sc.nextInt();
    int word2Cnt = sc.nextInt();
    String word3 = sc.next();
    
    if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    }
    
    System.out.println(word1Cnt +" "+ word2Cnt);
  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String word1 = sc.next();
    String word2 = sc.next();
    int word1Cnt = sc.nextInt();
    int word2Cnt = sc.nextInt();
    String word3 = sc.next();
    
    if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    }
    
    System.out.println(word1Cnt +" "+ word2Cnt);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String word1 = sc.next();
    String word2 = sc.next();
    int word1Cnt = sc.nextInt();
    int word2Cnt = sc.nextInt();
    String word3 = sc.next();
    
    if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    }
    
    System.out.println(word1Cnt +" "+ word2Cnt);
  } main {
    Scanner sc = new Scanner(System.in);
    String word1 = sc.next();
    String word2 = sc.next();
    int word1Cnt = sc.nextInt();
    int word2Cnt = sc.nextInt();
    String word3 = sc.next();
    
    if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    }
    
    System.out.println(word1Cnt +" "+ word2Cnt);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String word1 = sc.next(); word1 sc.next() sc.next sc String word2 = sc.next(); word2 sc.next() sc.next sc int word1Cnt = sc.nextInt(); word1Cnt sc.nextInt() sc.nextInt sc int word2Cnt = sc.nextInt(); word2Cnt sc.nextInt() sc.nextInt sc String word3 = sc.next(); word3 sc.next() sc.next sc if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    } word1.equals(word3) word1.equals word1 word3 {
      word1Cnt--;
    } word1Cnt-- word1Cnt if(word2.equals(word3)){
      word2Cnt--;
    }else {
    } word2.equals(word3) word2.equals word2 word3 {
      word2Cnt--;
    } word2Cnt-- word2Cnt {
    } System.out.println(word1Cnt +" "+ word2Cnt) System.out.println System.out System System.out word1Cnt +" "+ word2Cnt word1Cnt +" "+ word2Cnt word1Cnt " " word2Cnt String[] args args
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String word1 = sc.next();
    String word2 = sc.next();
    int word1Cnt = sc.nextInt();
    int word2Cnt = sc.nextInt();
    String word3 = sc.next();
    
    if(word1.equals(word3)){
      word1Cnt--;
    }else if(word2.equals(word3)){
      word2Cnt--;
    }else {
    }
    
    System.out.println(word1Cnt +" "+ word2Cnt);
  }
}
