import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	}

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

	public static void main(String[] args) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	}

} Main public static void main(String[] args) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	} main {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	} int a a b; b String s s t t c; c Scanner sc = new Scanner(System.in); sc new Scanner(System.in) s = sc.next() s sc.next() sc.next sc t = sc.next() t sc.next() sc.next sc a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt() b sc.nextInt() sc.nextInt sc c = sc.next() c sc.next() sc.next sc if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		} s.equals(c) s.equals s c {
			a = a - 1;
		} a = a - 1 a a - 1 a 1 {
			b = b - 1;
		} b = b - 1 b b - 1 b 1 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) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	}

} public class Main {

	public static void main(String[] args) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int a,b;
		String s,t,c;

		Scanner sc = new Scanner(System.in);

		s = sc.next();
		t = sc.next();

		a = sc.nextInt();
		b = sc.nextInt();

		c = sc.next();

		if (s.equals(c) ) {
			a = a - 1;
		} else {
			b = b - 1;
		}

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

	}

}
