import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		} main {
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String r = sc.next(); r sc.next() sc.next sc String b = sc.nextLine(); b sc.nextLine() sc.nextLine sc int rn = sc.nextInt(); rn sc.nextInt() sc.nextInt sc int bn = sc.nextInt(); bn sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String u = sc.nextLine(); u sc.nextLine() sc.nextLine sc if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		} r.equals(u) r.equals r u {
			System.out.println(rn-1+" "+bn);
		} System.out.println(rn-1+" "+bn) System.out.println System.out System System.out rn-1+" "+bn rn-1+" "+bn rn-1 rn 1 " " bn {
			bn--;
			System.out.println(rn+" "+bn);
		} bn-- bn System.out.println(rn+" "+bn) System.out.println System.out System System.out rn+" "+bn rn+" "+bn rn " " bn String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
}