import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	}
}

 import java.io.*; io.* java import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	}
} Main public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String []s=br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String S = s[0]; S s[0] s 0 String T = s[1]; T s[1] s 1 s=br.readLine().split(" ") s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int A = Integer.parseInt(s[0]); A Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int B = Integer.parseInt(s[1]); B Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 String U = br.readLine(); U br.readLine() br.readLine br if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1)); U.equals(S) U.equals U S out.println((A-1)+" "+B) out.println out (A-1)+" "+B (A-1)+" "+B (A-1) A 1 " " B out.println(A+" "+(B-1)) out.println out A+" "+(B-1) A+" "+(B-1) A " " (B-1) B 1 String []args args public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	}
} public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	}
} Main
import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		String S = s[0];
		String T = s[1];
		
		s=br.readLine().split(" ");
		int A = Integer.parseInt(s[0]);
		int B = Integer.parseInt(s[1]);
		
		String U = br.readLine();
		
		if(U.equals(S))
			out.println((A-1)+" "+B);
		else
			out.println(A+" "+(B-1));
		
	}
}


