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 n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	}

} 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 n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	}

} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	} main {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	} 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 n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int m=sc.nextInt(); m sc.nextInt() sc.nextInt sc String u=sc.next(); u sc.next() sc.next sc if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1; u.contentEquals(s) u.contentEquals u s n=n-1 n n-1 n 1 if(u.equalsIgnoreCase(t))
			m=m-1; u.equalsIgnoreCase(t) u.equalsIgnoreCase u t m=m-1 m m-1 m 1 System.out.print(n + " " +m) System.out.print System.out System System.out n + " " +m n + " " +m n " " m 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 n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	}

} 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 n=sc.nextInt();
		int m=sc.nextInt();
		String u=sc.next();
		if(u.contentEquals(s))
			n=n-1;
		else if(u.equalsIgnoreCase(t))
			m=m-1;
		System.out.print(n + " " +m); 
		
	}

}
