import java.util.Scanner;

public class Main {


	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {


	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	}
} Main public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	} main {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	} Scanner sca = new Scanner(System.in); sca new Scanner(System.in) String s = sca.next(); s sca.next() sca.next sca String t = sca.next(); t sca.next() sca.next sca int a = sca.nextInt(); a sca.nextInt() sca.nextInt sca int b = sca.nextInt(); b sca.nextInt() sca.nextInt sca String u = sca.next(); u sca.next() sca.next sca if(u.equals(s)) {
		a--;
	}
	else {
		b--;
	} u.equals(s) u.equals u s {
		a--;
	} a-- a {
		b--;
	} b-- b System.out.print(a) System.out.print System.out System System.out a System.out.print(" ") System.out.print System.out System System.out " " System.out.println(b) System.out.println System.out System System.out b sca.close() sca.close sca String[] args args public class Main {


	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	}
} public class Main {


	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	}
} Main
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	String s = sca.next();
	String t = sca.next();
	int a = sca.nextInt();
	int b = sca.nextInt();
	String u = sca.next();

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

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

	// 後始末
	sca.close();
	}
}