import java.util.*;
import java.util.Comparator;

public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    }
} import java.util.*; util.* java import java.util.Comparator; Comparator java.util public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    }
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    } main {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) long o1=0; o1 0 long o2=0; o2 0 String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc o1=sc.nextLong() o1 sc.nextLong() sc.nextLong sc o2=sc.nextLong() o2 sc.nextLong() sc.nextLong sc String u=sc.next(); u sc.next() sc.next sc if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        } s.equals(u) s.equals s u {
        	o1--;
        } o1-- o1 {
        	o2--;
        } o2-- o2 System.out.println(o1+" "+o2) System.out.println System.out System System.out o1+" "+o2 o1+" "+o2 o1 " " o2 String[] args args public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    }
} public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    }
} Main
import java.util.*;
import java.util.Comparator;

public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long o1=0;
        long o2=0;
        String s=sc.next();
        String t=sc.next();
        o1=sc.nextLong();
        o2=sc.nextLong();
        String u=sc.next();
        if(s.equals(u)){
        	o1--;
        }else{
        	o2--;
        }
        
      
      System.out.println(o1+" "+o2);
    }
}