import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  }
} import java.util.*; util.* java public class Main
{
  public static void main(String[] args)
  {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  }
} Main public static void main(String[] args)
  {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  } main {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  } Scanner s=new Scanner(System.in); s new Scanner(System.in) String st1=s.next(); st1 s.next() s.next s String st2=s.next(); st2 s.next() s.next s int a=s.nextInt(); a s.nextInt() s.nextInt s int b=s.nextInt(); b s.nextInt() s.nextInt s String st3=s.next(); st3 s.next() s.next s if(st3.equals(st1))
      a--;
    else
      b--; st3.equals(st1) st3.equals st3 st1 a-- a 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 s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  }
} public class Main
{
  public static void main(String[] args)
  {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  }
} Main
import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner s=new Scanner(System.in);
    String st1=s.next();
    String st2=s.next();
    int a=s.nextInt();
    int b=s.nextInt();
    String st3=s.next();
    if(st3.equals(st1))
      a--;
    else
      b--;
    System.out.println(a+" "+b);
  }
}
