import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	}
} Main public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	} main {

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s1 = scan.next(); s1 scan.next() scan.next scan String s2 = scan.next(); s2 scan.next() scan.next scan int n1 = scan.nextInt(); n1 scan.nextInt() scan.nextInt scan int n2 = scan.nextInt(); n2 scan.nextInt() scan.nextInt scan if(scan.next().equals(s1))n1--;
		else n2--; scan.next().equals(s1) scan.next().equals scan.next() scan.next scan s1 n1-- n1 n2-- n2 System.out.println(n1 + " " + n2) System.out.println System.out System System.out n1 + " " + n2 n1 + " " + n2 n1 " " n2 String args[] args public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	}
} public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);

		String s1 = scan.next();
		String s2 = scan.next();
		
		int n1 = scan.nextInt();
		int n2 = scan.nextInt();
		
		if(scan.next().equals(s1))n1--;
		else n2--;
		
		System.out.println(n1 + " " + n2);
	}
}