import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  }
} Main public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  } main {
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  } Scanner sc= new Scanner(System.in); sc new Scanner(System.in) String s=sc.next() s sc.next() sc.next sc t=sc.next(); t sc.next() sc.next sc int si=sc.nextInt() si sc.nextInt() sc.nextInt sc ti=sc.nextInt(); ti sc.nextInt() sc.nextInt sc String u =sc.next(); u sc.next() sc.next sc if(u.equals(s)) si--;
    else ti--; u.equals(s) u.equals u s si-- si ti-- ti System.out.println(si +" "+ti) System.out.println System.out System System.out si +" "+ti si +" "+ti si " " ti String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    String s=sc.next(), t=sc.next();
    int si=sc.nextInt(), ti=sc.nextInt();
    String u =sc.next();
    
    if(u.equals(s)) si--;
    else ti--;
    
    System.out.println(si +" "+ti);
  }
}