import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
} import java.util.Scanner; Scanner 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 countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	} 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 countA = sc.nextInt(); countA sc.nextInt() sc.nextInt sc int countB = sc.nextInt(); countB sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		} S.equals(U)==true S.equals(U) S.equals S U true {
			System.out.println(countA-1);
			System.out.println(countB);
		} System.out.println(countA-1) System.out.println System.out System System.out countA-1 countA 1 System.out.println(countB) System.out.println System.out System System.out countB {
			System.out.println(countA);
			System.out.println(countB-1);
		} System.out.println(countA) System.out.println System.out System System.out countA System.out.println(countB-1) System.out.println System.out System System.out countB-1 countB 1 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 countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int countA = sc.nextInt();
		int countB = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)==true) {
			System.out.println(countA-1);
			System.out.println(countB);
		} else {
			System.out.println(countA);
			System.out.println(countB-1);
		}
	}
}