import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	}
	} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	}
	} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int Sn = sc.nextInt(); Sn sc.nextInt() sc.nextInt sc int Tn = sc.nextInt(); Tn sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc if(U.contentEquals(S)) {
			Sn -= 1;
		    } U.contentEquals(S) U.contentEquals U S {
			Sn -= 1;
		    } Sn -= 1 Sn 1 if(T.contentEquals(U)) {
			Tn -= 1;	
			} T.contentEquals(U) T.contentEquals T U {
			Tn -= 1;	
			} Tn -= 1 Tn 1 System.out.println(Sn) System.out.println System.out System System.out Sn System.out.println(Tn) System.out.println System.out System System.out Tn String[] args args public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	}
	} public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	}
	} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int Sn = sc.nextInt();
		int Tn = sc.nextInt();
		
		String U = sc.next();
		
		if(U.contentEquals(S)) {
			Sn -= 1;
		    }
		if(T.contentEquals(U)) {
			Tn -= 1;	
			}
		System.out.println(Sn);
		System.out.println(Tn);
	
	}
	}