import java.util.*;
public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


}

  import java.util.*; util.* java public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	} main {
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String a = s.split(" ")[0]; a s.split(" ")[0] s.split(" ") s.split s " " 0 String b = s.split(" ")[1]; b s.split(" ")[1] s.split(" ") s.split s " " 1 int a_ = sc.nextInt(); a_ sc.nextInt() sc.nextInt sc int b_ = sc.nextInt(); b_ sc.nextInt() sc.nextInt sc String key = sc.next(); key sc.next() sc.next sc if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		} a.equals(key) a.equals a key {
			System.out.println(a_ - 1 + " " + b_);
		} System.out.println(a_ - 1 + " " + b_) System.out.println System.out System System.out a_ - 1 + " " + b_ a_ - 1 + " " + b_ a_ - 1 a_ 1 " " b_ {
			System.out.println(a_ + " " + String.valueOf(--b_));
		} System.out.println(a_ + " " + String.valueOf(--b_)) System.out.println System.out System System.out a_ + " " + String.valueOf(--b_) a_ + " " + String.valueOf(--b_) a_ " " String.valueOf(--b_) String.valueOf String --b_ b_ String[] args args public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


} public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


} Main
import java.util.*;
public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


}

 