import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	} 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 scount = sc.nextInt(); scount sc.nextInt() sc.nextInt sc int tcount = sc.nextInt(); tcount sc.nextInt() sc.nextInt sc String u = sc.next(); u sc.next() sc.next sc if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		} s.equals(u) s.equals s u {
			scount = --scount; 
			
		} scount = --scount scount --scount scount {
			tcount= --tcount;
		} tcount= --tcount tcount --tcount tcount System.out.println(scount+" "+tcount) System.out.println System.out System System.out scount+" "+tcount scount+" "+tcount scount " " tcount String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int scount = sc.nextInt();
		int tcount = sc.nextInt();

		String u = sc.next();
		
		if(s.equals(u)) {
			scount = --scount; 
			
		}else {
			tcount= --tcount;
		}
		

		System.out.println(scount+" "+tcount);
		

	}
}