import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
} import java.util.*; util.* java public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	} main {
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S S T T U; U S = sc.next() S sc.next() sc.next sc T = sc.next() T sc.next() sc.next sc int A=0 A 0 B=0; B 0 A = sc.nextInt() A sc.nextInt() sc.nextInt sc B = sc.nextInt() B sc.nextInt() sc.nextInt sc U = sc.next() U sc.next() sc.next sc if (S.compareTo(U)==0){
      A--;
    } S.compareTo(U)==0 S.compareTo(U) S.compareTo S U 0 {
      A--;
    } A-- A if (T.compareTo(U)==0){
      B--;
    } T.compareTo(U)==0 T.compareTo(U) T.compareTo T U 0 {
      B--;
    } B-- B 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 sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
} public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
} Main
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
}