import java.util.Scanner;

public 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 if(U.equals(T)){
        B = B-1;
      }
      
      System.out.println(A+" "+B);
      
    }
} import java.util.Scanner; Scanner java.util public 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 if(U.equals(T)){
        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 if(U.equals(T)){
        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 if(U.equals(T)){
        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 if(U.equals(T)){
        B = B-1;
      } U.equals(S) U.equals U S {
        A = A-1;
      } A = A-1 A A-1 A 1 if(U.equals(T)){
        B = B-1;
      } U.equals(T) U.equals U T {
        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 public 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 if(U.equals(T)){
        B = B-1;
      }
      
      System.out.println(A+" "+B);
      
    }
} public 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 if(U.equals(T)){
        B = B-1;
      }
      
      System.out.println(A+" "+B);
      
    }
} Main
import java.util.Scanner;

public 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 if(U.equals(T)){
        B = B-1;
      }
      
      System.out.println(A+" "+B);
      
    }
}