import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		if(U.equals(S)){
			A = A - 1;
		}
		else if(U.equals(T)){
			B = B - 1;
		}
		
		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 St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		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 sc = new Scanner(System.in);
		String St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		if(U.equals(S)){
			A = A - 1;
		}
		else if(U.equals(T)){
			B = B - 1;
		}
		
		System.out.println(A+" "+B);
	} main {
		Scanner sc = new Scanner(System.in);
		String St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		if(U.equals(S)){
			A = A - 1;
		}
		else if(U.equals(T)){
			B = B - 1;
		}
		
		System.out.println(A+" "+B);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String St = sc.nextLine(); St sc.nextLine() sc.nextLine sc String num = sc.nextLine(); num sc.nextLine() sc.nextLine sc String U = sc.nextLine(); U sc.nextLine() sc.nextLine sc String[] str1 = St.split(" "); str1 St.split(" ") St.split St " " String[] str2 = num.split(" "); str2 num.split(" ") num.split num " " String S = str1[0]; S str1[0] str1 0 String T = str1[1]; T str1[1] str1 1 int A = Integer.parseInt(str2[0]); A Integer.parseInt(str2[0]) Integer.parseInt Integer str2[0] str2 0 int B = Integer.parseInt(str2[1]); B Integer.parseInt(str2[1]) Integer.parseInt Integer str2[1] str2 1 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 sc = new Scanner(System.in);
		String St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		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 sc = new Scanner(System.in);
		String St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		if(U.equals(S)){
			A = A - 1;
		}
		else if(U.equals(T)){
			B = B - 1;
		}
		
		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 St = sc.nextLine();
		String num = sc.nextLine();
		String U = sc.nextLine();
		
		String[] str1 = St.split(" ");
		String[] str2 = num.split(" ");
		
		String S = str1[0];
		String T = str1[1];
		
		int A = Integer.parseInt(str2[0]);
		int B = Integer.parseInt(str2[1]);
				
		if(U.equals(S)){
			A = A - 1;
		}
		else if(U.equals(T)){
			B = B - 1;
		}
		
		System.out.println(A+" "+B);
	}
}