import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	} main {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) String S = s.next(); S s.next() s.next s String T = s.next(); T s.next() s.next s int A = s.nextInt(); A s.nextInt() s.nextInt s int B = s.nextInt(); B s.nextInt() s.nextInt s String U = s.next(); U s.next() s.next s if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		} U.equals(S) U.equals U S {
			A--;
		} A-- A if (U.equals(T)) {
			B--;
		} U.equals(T) U.equals U T {
			B--;
		} B-- B System.out.println(A + " " + B) System.out.println System.out System System.out A + " " + B A + " " + B A " " B String[] args args public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		String T = s.next();
		int A = s.nextInt();
		int B = s.nextInt();
		String U = s.next();

		if(U.equals(S)) {
			A--;
		} else if (U.equals(T)) {
			B--;
		}
		System.out.println(A + " " + B);
	}
}
