import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  } main {
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if(S.equals(U)){
      a--;
    }else{
      b--;
    } S.equals(U) S.equals S U {
      a--;
    } a-- a {
      b--;
    } b-- b System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] args args public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  }
} public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  }
} Main
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String S = scanner.next();
    String T = scanner.next();
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    String U = scanner.next();
    
    if(S.equals(U)){
      a--;
    }else{
      b--;
    }
    System.out.println(a + " " + b);
    
  }
}