import java.util.*;

public class Main {
 
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  }
  
} import java.util.*; util.* java public class Main {
 
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  }
  
} Main public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  } main {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String stringS = sc.next(); stringS sc.next() sc.next sc String stringT = sc.next(); stringT sc.next() sc.next sc int lengthS = sc.nextInt(); lengthS sc.nextInt() sc.nextInt sc int lengthT = sc.nextInt(); lengthT sc.nextInt() sc.nextInt sc String stringU = sc.next(); stringU sc.next() sc.next sc if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    } stringU.equals(stringS) stringU.equals stringU stringS {
      lengthS--;
    } lengthS-- lengthS {
      lengthT--;
    } lengthT-- lengthT System.out.println(lengthS + " " + lengthT) System.out.println System.out System System.out lengthS + " " + lengthT lengthS + " " + lengthT lengthS " " lengthT String[] args args public class Main {
 
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  }
  
} public class Main {
 
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  }
  
} Main
import java.util.*;

public class Main {
 
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    String stringS = sc.next();
    String stringT = sc.next();
    
    int lengthS = sc.nextInt();
    int lengthT = sc.nextInt();
    
    String stringU = sc.next();
    
    if (stringU.equals(stringS)) {
      lengthS--;
    } else {
      lengthT--;
    }
    
    System.out.println(lengthS + " " + lengthT);
    
  }
  
}