import java.io.*;
import java.util.*;
public class Main{

     public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{

     public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     }
} Main public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     } main {
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     } Scanner s=new Scanner(System.in); s new Scanner(System.in) String a=s.next(); a s.next() s.next s String b=s.next(); b s.next() s.next s long aa=s.nextLong(); aa s.nextLong() s.nextLong s long bb=s.nextLong(); bb s.nextLong() s.nextLong s String c=s.next(); c s.next() s.next s if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);} c.equals(a) c.equals c a {aa--;
      System.out.println(aa+" "+bb);} aa-- aa System.out.println(aa+" "+bb) System.out.println System.out System System.out aa+" "+bb aa+" "+bb aa " " bb {bb--;
      System.out.println(aa+" "+bb);} bb-- bb System.out.println(aa+" "+bb) System.out.println System.out System System.out aa+" "+bb aa+" "+bb aa " " bb String []args args public class Main{

     public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     }
} public class Main{

     public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     }
} Main
import java.io.*;
import java.util.*;
public class Main{

     public static void main(String []args){
    Scanner s=new Scanner(System.in);
      String a=s.next();
      String b=s.next();
      long aa=s.nextLong();
      long bb=s.nextLong();
      String c=s.next();
      if(c.equals(a))
      {aa--;
      System.out.println(aa+" "+bb);}
      else
      {bb--;
      System.out.println(aa+" "+bb);}
    
    
     }
}