import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) String S = st.nextToken(); S st.nextToken() st.nextToken st String T = st.nextToken(); T st.nextToken() st.nextToken st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) int A = Integer.parseInt(st.nextToken()); A Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int B = Integer.parseInt(st.nextToken()); B Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st String U = br.readLine(); U br.readLine() br.readLine br 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 String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		String S = st.nextToken();
		String T = st.nextToken();
		
		st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		
		String U = br.readLine();
		
		if(S.equals(U))
			A--;
		else
			B--;
		
		System.out.println(A+ " " +B);
	}

}