import java.util.Scanner;

public class Main {
	static int maxn = 300 + 10;

	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	}

} import java.util.Scanner; Scanner java.util public class Main {
	static int maxn = 300 + 10;

	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	}

} Main static int maxn = 300 + 10; maxn 300 + 10 300 10 public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	} main {
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	} Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int numa numa numb; numb String stra stra strb; strb stra=cin.next() stra cin.next() cin.next cin strb=cin.next() strb cin.next() cin.next cin numa=cin.nextInt() numa cin.nextInt() cin.nextInt cin numb=cin.nextInt() numb cin.nextInt() cin.nextInt cin String temp=cin.next(); temp cin.next() cin.next cin if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		} temp.equals(stra) temp.equals temp stra {
			numa--;
		} numa-- numa if(temp.equals(strb))
		{
			numb--;
		} temp.equals(strb) temp.equals temp strb {
			numb--;
		} numb-- numb System.out.println(numa+ " "+numb) System.out.println System.out System System.out numa+ " "+numb numa+ " "+numb numa " " numb String[] args args public class Main {
	static int maxn = 300 + 10;

	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	}

} public class Main {
	static int maxn = 300 + 10;

	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	}

} Main
import java.util.Scanner;

public class Main {
	static int maxn = 300 + 10;

	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		int numa,numb;
		String stra,strb;
		stra=cin.next();
		strb=cin.next();
		numa=cin.nextInt();
		numb=cin.nextInt();
		String temp=cin.next();
		if(temp.equals(stra))
		{
			numa--;
		}
		else if(temp.equals(strb))
		{
			numb--;
		}
		System.out.println(numa+ " "+numb);
	}

}