import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 }
} import java.util.ArrayList; ArrayList java.util import java.util.Collection; Collection java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Map.Entry; Entry java.util.Map import java.util.Scanner; Scanner java.util public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 }
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static void p(String ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans String ans ans static void p(int ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans int ans ans static void p(long ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans long ans ans public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 } main {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 } String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc int a =sc.nextInt(); a sc.nextInt() sc.nextInt sc int b =sc.nextInt(); b sc.nextInt() sc.nextInt sc String u=sc.next(); u sc.next() sc.next sc if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	} s.equals(u) s.equals s u {
		a--;
	} a-- a if(t.equals(u)) {
		b--;
	} t.equals(u) t.equals t u {
		b--;
	} b-- b System.out.print(a+" "+b) System.out.print System.out System System.out a+" "+b a+" "+b a " " b String[] args args public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 }
} public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 }
} Main
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	String s=sc.next();
	String t=sc.next();
	int a =sc.nextInt();
	int b =sc.nextInt();
	String u=sc.next();
	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	//ArrayList<String> cc = new ArrayList<>(n);
	if(s.equals(u)) {
		a--;
	}else if(t.equals(u)) {
		b--;
	}
	System.out.print(a+" "+b);

	
	
	
	
 }
}