import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	}

} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	} main {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String S=scan.next(); S scan.next() scan.next scan String T=scan.next(); T scan.next() scan.next scan int A=scan.nextInt(); A scan.nextInt() scan.nextInt scan int B=scan.nextInt(); B scan.nextInt() scan.nextInt scan String U=scan.next(); U scan.next() scan.next scan if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		} S.equalsIgnoreCase(U) S.equalsIgnoreCase S U {
			A--;
		} A-- A {
			B--;
	
		} B-- B System.out.println(A) System.out.println System.out System System.out A System.out.println(B) System.out.println System.out System System.out B String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String S=scan.next();
		String T=scan.next();
		int A=scan.nextInt();
		int B=scan.nextInt();
		String U=scan.next();
		if(S.equalsIgnoreCase(U))
		{
			A--;
		}
		else {
			B--;
	
		}
		System.out.println(A);
		System.out.println(B);
	}

}