import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	}
} Main public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	} main {
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	} double[] d = new double[50]; d new double[50] 50 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.nextLine(); str scan.nextLine() scan.nextLine scan String[] substr = str.split(" ", 0); substr str.split(" ", 0) str.split str " " 0 String s0 = substr[0]; s0 substr[0] substr 0 String s1 = substr[1]; s1 substr[1] substr 1 str = scan.nextLine() str scan.nextLine() scan.nextLine scan substr = str.split(" ", 0) substr str.split(" ", 0) str.split str " " 0 int n0 = Integer.parseInt(substr[0]); n0 Integer.parseInt(substr[0]) Integer.parseInt Integer substr[0] substr 0 int n1 = Integer.parseInt(substr[1]); n1 Integer.parseInt(substr[1]) Integer.parseInt Integer substr[1] substr 1 str = scan.nextLine() str scan.nextLine() scan.nextLine scan if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		} str.equals(s0) str.equals str s0 {
			n0--;
		} n0-- n0 {
			n1--;
		} n1-- n1 System.out.println(n0+" "+n1) System.out.println System.out System System.out n0+" "+n1 n0+" "+n1 n0 " " n1 String[] args args public class Main
{
	public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	}
} public class Main
{
	public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	}
} Main
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		double[] d = new double[50];

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		String[] substr = str.split(" ", 0);

		String s0 = substr[0];
		String s1 = substr[1];

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n0 = Integer.parseInt(substr[0]);
		int n1 = Integer.parseInt(substr[1]);

		str = scan.nextLine();

		if (str.equals(s0)) {
			n0--;
		} else {
			n1--;
		}
		System.out.println(n0+" "+n1);
	}
}
