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 rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

} 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 rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	} 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 rb = sc.nextInt(); rb sc.nextInt() sc.nextInt sc int bb = sc.nextInt(); bb sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc sc.close() sc.close sc if (U.equals(S)) {
			rb--;
		} U.equals(S) U.equals U S {
			rb--;
		} rb-- rb if(U.equals(T)) {
			bb--;
		} U.equals(T) U.equals U T {
			bb--;
		} bb-- bb System.out.println(rb + " " + bb) System.out.println System.out System System.out rb + " " + bb rb + " " + bb rb " " bb 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 rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

} 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 rb = sc.nextInt();
		int bb = sc.nextInt();
		String U = sc.next();
		sc.close();
		if (U.equals(S)) {
			rb--;
		}
		if(U.equals(T)) {
			bb--;
		}
		System.out.println(rb + " " + bb);
	}

}
