import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc String U = sc.next(); U sc.next() sc.next sc if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        } S.equals(U) S.equals S U {
            System.out.printf("%d %d", a-1, b);
        } System.out.printf("%d %d", a-1, b) System.out.printf System.out System System.out "%d %d" a-1 a 1 b {
            System.out.printf("%d %d", a, b-1);
        } System.out.printf("%d %d", a, b-1) System.out.printf System.out System System.out "%d %d" a b-1 b 1 return; String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();
        if(S.equals(U)){
            System.out.printf("%d %d", a-1, b);
        }else{
            System.out.printf("%d %d", a, b-1);
        }
        return;
    }
}