import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String Smozi = scan.next(); Smozi scan.next() scan.next scan String Tmozi = scan.next(); Tmozi scan.next() scan.next scan int Aball = scan.nextInt(); Aball scan.nextInt() scan.nextInt scan int Bball = scan.nextInt(); Bball scan.nextInt() scan.nextInt scan String Umozi = scan.next(); Umozi scan.next() scan.next scan if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		} Smozi.equals(Umozi) Smozi.equals Smozi Umozi {
			Aball -= 1;
		} Aball -= 1 Aball 1 if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		} Tmozi.equals(Umozi) Tmozi.equals Tmozi Umozi {
			Bball -= 1;
		} Bball -= 1 Bball 1 System.out.println(Aball+ " "+Bball) System.out.println System.out System System.out Aball+ " "+Bball Aball+ " "+Bball Aball " " Bball scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

}
