import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	} main {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String strS = scan.next() strS scan.next() scan.next scan strT = scan.next(); strT scan.next() scan.next scan int countA = scan.nextInt() countA scan.nextInt() scan.nextInt scan countB = scan.nextInt(); countB scan.nextInt() scan.nextInt scan String u = scan.next(); u scan.next() scan.next scan scan.close() scan.close scan if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		} u.equals(strS) u.equals u strS {
			countA--;
		} countA-- countA {
			countB--;
		} countB-- countB System.out.println(countA + " " + countB) System.out.println System.out System System.out countA + " " + countB countA + " " + countB countA " " countB String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

}
