import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String args[]){
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    }
} Main public static void main(String args[]){
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    } main {
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

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

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    }
} public class Main{
    public static void main(String args[]){
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        
        Scanner scan = new Scanner(System.in);

        String S = scan.next();
        String T = scan.next();
        int A = scan.nextInt();
        int B = scan.nextInt();
        String U = scan.next();
        if(S.equals(U)) A=A-1;
        else B=B-1;
        System.out.printf("%d %d",A,B);

    }
}