import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	} main {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int b1 b1 b2; b2 String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] a = str.split(" "); a str.split(" ") str.split str " " String str1 = sc.nextLine(); str1 sc.nextLine() sc.nextLine sc String[] a1 = str1.split(" "); a1 str1.split(" ") str1.split str1 " " String str2 = sc.nextLine(); str2 sc.nextLine() sc.nextLine sc if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		} str2.equals(a[0]) str2.equals str2 a[0] a 0 {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		} b1 = Integer.parseInt(a1[0])-1 b1 Integer.parseInt(a1[0])-1 Integer.parseInt(a1[0]) Integer.parseInt Integer a1[0] a1 0 1 b2 = Integer.parseInt(a1[1]) b2 Integer.parseInt(a1[1]) Integer.parseInt Integer a1[1] a1 1 {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		} b1 = Integer.parseInt(a1[0]) b1 Integer.parseInt(a1[0]) Integer.parseInt Integer a1[0] a1 0 b2 = Integer.parseInt(a1[1])-1 b2 Integer.parseInt(a1[1])-1 Integer.parseInt(a1[1]) Integer.parseInt Integer a1[1] a1 1 1 System.out.println(b1+" "+b2) System.out.println System.out System System.out b1+" "+b2 b1+" "+b2 b1 " " b2 String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int b1,b2;
		String str = sc.nextLine();
		String[] a = str.split(" ");
		String str1 = sc.nextLine();
		String[] a1 = str1.split(" ");
		String str2 = sc.nextLine();
		if(str2.equals(a[0])) {
			b1 = Integer.parseInt(a1[0])-1;
			b2 = Integer.parseInt(a1[1]);
		}
		else {
			b1 = Integer.parseInt(a1[0]);
			b2 = Integer.parseInt(a1[1])-1;
		}
		System.out.println(b1+" "+b2);
		
	}
}