import 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
} import java.util.*; util.* java 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
} 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  } 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  } 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)){
      a--;
    }else{
      b--;
    } s.equals(u) s.equals s u {
      a--;
    } a-- a {
      b--;
    } b-- b String sA = String.valueOf(a); sA String.valueOf(a) String.valueOf String a String sB = String.valueOf(b); sB String.valueOf(b) String.valueOf String b System.out.println( sA + " " + sB) System.out.println System.out System System.out sA + " " + sB sA + " " + sB sA " " sB 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
} 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
} Main
import 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)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
}