import java.util.*;

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

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

	public static void main(String[] args) {
		new Main().calc();
	}
} Main Scanner sc; sc String S S T T U; U int A A B; B private void calc() {
		sc = new Scanner(System.in);
		S = sc.next();
		T = sc.next();
		A = sc.nextInt();
		B = sc.nextInt();
		U = sc.next();
		if (S.equals(U)) A--;
		else B--;
		System.out.println(A+" "+B);
	} calc {
		sc = new Scanner(System.in);
		S = sc.next();
		T = sc.next();
		A = sc.nextInt();
		B = sc.nextInt();
		U = sc.next();
		if (S.equals(U)) A--;
		else B--;
		System.out.println(A+" "+B);
	} sc = new Scanner(System.in) sc new Scanner(System.in) S = sc.next() S sc.next() sc.next sc T = sc.next() T sc.next() sc.next sc A = sc.nextInt() A sc.nextInt() sc.nextInt sc B = sc.nextInt() B sc.nextInt() sc.nextInt sc 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 public static void main(String[] args) {
		new Main().calc();
	} main {
		new Main().calc();
	} new Main().calc() new Main().calc new Main() String[] args args
import java.util.*;

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

	public static void main(String[] args) {
		new Main().calc();
	}
}
