import java.util.*;

public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	}
} import java.util.*; util.* java public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	} main {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a= sc.next(); a sc.next() sc.next sc String b= sc.next(); b sc.next() sc.next sc int c= sc.nextInt(); c sc.nextInt() sc.nextInt sc int d= sc.nextInt(); d sc.nextInt() sc.nextInt sc String e= sc.next(); e sc.next() sc.next sc if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		} e.contentEquals(a) e.contentEquals e a {
			c--;
		} c-- c {
			d--;
		} d-- d System.out.println(c+" "+d) System.out.println System.out System System.out c+" "+d c+" "+d c " " d String[] args args public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	}
} public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	}
} Main
import java.util.*;

public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a= sc.next();
		String b= sc.next();
		int c= sc.nextInt();
		int d= sc.nextInt();
		String e= sc.next();
		if(e.contentEquals(a)) {
			c--;
		}
		else {
			d--;
		}
		System.out.println(c+" "+d);
	}
}
