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