import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    } main {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        } U.equals(S) U.equals U S {
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        } System.out.print(A-1) System.out.print System.out System System.out A-1 A 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println(B) System.out.println System.out System System.out B {
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        } 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-1) System.out.println System.out System System.out B-1 B 1 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        
        if(U.equals(S)){
            System.out.print(A-1);
            System.out.print(" ");
            System.out.println(B);
        }else{
            System.out.print(A);
            System.out.print(" ");
            System.out.println(B-1);
        }
        
    }
}
