import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	} main {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String red = sc.next(); red sc.next() sc.next sc String blue = sc.next(); blue sc.next() sc.next sc int redN = sc.nextInt(); redN sc.nextInt() sc.nextInt sc int blueN = sc.nextInt(); blueN sc.nextInt() sc.nextInt sc String either = sc.next(); either sc.next() sc.next sc if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		} either.equals(red) either.equals either red {
			redN--;
		} redN-- redN {
			blueN--;
		} blueN-- blueN System.out.println(redN + " " + blueN) System.out.println System.out System System.out redN + " " + blueN redN + " " + blueN redN " " blueN String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String red = sc.next();
		String blue = sc.next();
		int redN = sc.nextInt();
		int blueN = sc.nextInt();
		String either = sc.next();

		if(either.equals(red)) {
			redN--;
		}else {
			blueN--;
		}

		System.out.println(redN + " " + blueN);
	}
}