import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  }
} import java.util.*; util.* java public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  }
} Main public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  } main {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  } Scanner in=new Scanner(System.in); in new Scanner(System.in) String s=in.next(); s in.next() in.next in String t=in.next(); t in.next() in.next in int n=in.nextInt(); n in.nextInt() in.nextInt in int b=in.nextInt(); b in.nextInt() in.nextInt in String u=in.next(); u in.next() in.next in if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   } u.compareTo(s)==0 u.compareTo(s) u.compareTo u s 0 {
      System.out.println((n-1)+" "+b);
    } System.out.println((n-1)+" "+b) System.out.println System.out System System.out (n-1)+" "+b (n-1)+" "+b (n-1) n 1 " " b if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   } u.compareTo(t)==0 u.compareTo(t) u.compareTo u t 0 {
       System.out.println(n+" "+(b-1));
    } System.out.println(n+" "+(b-1)) System.out.println System.out System System.out n+" "+(b-1) n+" "+(b-1) n " " (b-1) b 1 {
     System.out.println(n+" "+b);
   } System.out.println(n+" "+b) System.out.println System.out System System.out n+" "+b n+" "+b n " " b String args[] args public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  }
} public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  }
} Main
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    String s=in.next();
    String t=in.next();
    int n=in.nextInt();
    int b=in.nextInt();
    String u=in.next();
    if(u.compareTo(s)==0)
    {
      System.out.println((n-1)+" "+b);
    }
    else if(u.compareTo(t)==0)
    {
       System.out.println(n+" "+(b-1));
    }
   else
   {
     System.out.println(n+" "+b);
   }
  }
}