import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1));
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1));
    }
} Main public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1));
    } main {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1));
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String SandT[] = br.readLine().split(" "); SandT br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String S = SandT[0]; S SandT[0] SandT 0 String T = SandT[1]; T SandT[1] SandT 1 String AandB[] = br.readLine().split(" "); AandB br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int A = Integer.parseInt(AandB[0]); A Integer.parseInt(AandB[0]) Integer.parseInt Integer AandB[0] AandB 0 int B = Integer.parseInt(AandB[1]); B Integer.parseInt(AandB[1]) Integer.parseInt Integer AandB[1] AandB 1 String U = br.readLine(); U br.readLine() br.readLine br if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1)); U.equals(S) U.equals U S System.out.println((A - 1) + " " + B) System.out.println System.out System System.out (A - 1) + " " + B (A - 1) + " " + B (A - 1) A 1 " " B if (U.equals(T))
	    System.out.println(A + " " + (B - 1)); U.equals(T) U.equals U T System.out.println(A + " " + (B - 1)) System.out.println System.out System System.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 SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.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 SandT[] = br.readLine().split(" ");
	String S = SandT[0];
	String T = SandT[1];
	String AandB[] = br.readLine().split(" ");
	int A = Integer.parseInt(AandB[0]);
	int B = Integer.parseInt(AandB[1]);
	String U = br.readLine();
	if (U.equals(S))
	    System.out.println((A - 1) + " " + B);
	else if (U.equals(T))
	    System.out.println(A + " " + (B - 1));
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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