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 s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	}

} 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 s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	} 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 s_count = sc.nextInt(); s_count sc.nextInt() sc.nextInt sc int t_count = sc.nextInt(); t_count sc.nextInt() sc.nextInt sc String u = sc.next(); u sc.next() sc.next sc if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    } s.equals(u) s.equals s u {
	    	s_count = s_count -1;
	    } s_count = s_count -1 s_count s_count -1 s_count 1 if(t.equals(u)) {
	    	t_count = t_count -1;
	    } t.equals(u) t.equals t u {
	    	t_count = t_count -1;
	    } t_count = t_count -1 t_count t_count -1 t_count 1 System.out.println(s_count+" "+t_count) System.out.println System.out System System.out s_count+" "+t_count s_count+" "+t_count s_count " " t_count 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 s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	}

} 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 s_count = sc.nextInt();
		int t_count = sc.nextInt();
	    String u = sc.next();
	    if(s.equals(u)) {
	    	s_count = s_count -1;
	    }else if(t.equals(u)) {
	    	t_count = t_count -1;
	    }
	    
	    System.out.println(s_count+" "+t_count);

	}

}