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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

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

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] sa = br.readLine().split(" "); sa br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String sa0 = sa[0]; sa0 sa[0] sa 0 sa = br.readLine().split(" ") sa br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int red = Integer.parseInt(sa[0]); red Integer.parseInt(sa[0]) Integer.parseInt Integer sa[0] sa 0 int blue = Integer.parseInt(sa[1]); blue Integer.parseInt(sa[1]) Integer.parseInt Integer sa[1] sa 1 String u = br.readLine(); u br.readLine() br.readLine br if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		} u.equals(sa0) u.equals u sa0 {
			red--;
		} red-- red {
			blue--;
		} blue-- blue System.out.println(red+ " " +blue) System.out.println System.out System System.out red+ " " +blue red+ " " +blue red " " blue String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		String sa0 = sa[0];
		sa = br.readLine().split(" ");
		int red = Integer.parseInt(sa[0]);
		int blue = Integer.parseInt(sa[1]);
		String u = br.readLine();
		if(u.equals(sa0)) {
			red--;
		}else {
			blue--;
		}
		System.out.println(red+ " " +blue);
		
	}

}
