import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}

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

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

} import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}

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

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

} Main public static void main(String[] args) throws Exception {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args void run() {
		Scanner sc = new Scanner(System.in);
		String S=sc.next();
		String T=sc.next();
		int A=sc.nextInt();
		int B=sc.nextInt();
		String U=sc.next();
		if(S.equals(U))--A;
		else --B;
		System.out.println(A+" "+B);
	} run {
		Scanner sc = new Scanner(System.in);
		String S=sc.next();
		String T=sc.next();
		int A=sc.nextInt();
		int B=sc.nextInt();
		String U=sc.next();
		if(S.equals(U))--A;
		else --B;
		System.out.println(A+" "+B);
	} 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 A=sc.nextInt(); A sc.nextInt() sc.nextInt sc int B=sc.nextInt(); B sc.nextInt() sc.nextInt sc String U=sc.next(); U sc.next() sc.next sc if(S.equals(U))--A;
		else --B; S.equals(U) S.equals S U --A A --B B System.out.println(A+" "+B) System.out.println System.out System System.out A+" "+B A+" "+B A " " B static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	} tr {
		System.out.println(Arrays.deepToString(objects));
	} System.out.println(Arrays.deepToString(objects)) System.out.println System.out System System.out Arrays.deepToString(objects) Arrays.deepToString Arrays objects Object... objects objects
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}

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

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
