import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	} String s s t t u; u int a a b; b Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) s = scanner.next() s scanner.next() scanner.next scanner t = scanner.next() t scanner.next() scanner.next scanner a = scanner.nextInt() a scanner.nextInt() scanner.nextInt scanner b = scanner.nextInt() b scanner.nextInt() scanner.nextInt scanner u = scanner.next() u scanner.next() scanner.next scanner if (s.equals(u)){
			a--;
		}else {
			b--;
		} s.equals(u) s.equals s u {
			a--;
		} a-- a {
			b--;
		} b-- b System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String s,t,u;
		int a,b;
		Scanner scanner = new Scanner(System.in);

		s = scanner.next();
		t = scanner.next();
		a = scanner.nextInt();
		b = scanner.nextInt();

		u = scanner.next();

		if (s.equals(u)){
			a--;
		}else {
			b--;
		}

		System.out.println(a + " " + b);
	}

}