import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	} main {
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Random rand = new Random(); rand new Random() String name1 = sc.next(); name1 sc.next() sc.next sc String name2 = sc.next(); name2 sc.next() sc.next sc int ball1 = sc.nextInt(); ball1 sc.nextInt() sc.nextInt sc int ball2 = sc.nextInt(); ball2 sc.nextInt() sc.nextInt sc String unstocked_ball = sc.next(); unstocked_ball sc.next() sc.next sc if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        } name1.equals(unstocked_ball) name1.equals name1 unstocked_ball {
            ball1 = ball1 -1;
        } ball1 = ball1 -1 ball1 ball1 -1 ball1 1 {
            ball2 = ball2 -1;
        } ball2 = ball2 -1 ball2 ball2 -1 ball2 1 System.out.println(ball1 + " " + ball2) System.out.println System.out System System.out ball1 + " " + ball2 ball1 + " " + ball2 ball1 " " ball2 String[] args args public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
} public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
}