import java.util.*;
class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String a=sc.next();
    String b=sc.next();
    int x=sc.nextInt();int y=sc.nextInt();
    String c=sc.next();
    if(c.equals(a))x--;
    else y--;
    System.out.print(x+" "+y);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String a=sc.next();
    String b=sc.next();
    int x=sc.nextInt();int y=sc.nextInt();
    String c=sc.next();
    if(c.equals(a))x--;
    else y--;
    System.out.print(x+" "+y);
  }
} Main public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String a=sc.next();
    String b=sc.next();
    int x=sc.nextInt();int y=sc.nextInt();
    String c=sc.next();
    if(c.equals(a))x--;
    else y--;
    System.out.print(x+" "+y);
  } main {
    Scanner sc=new Scanner(System.in);
    String a=sc.next();
    String b=sc.next();
    int x=sc.nextInt();int y=sc.nextInt();
    String c=sc.next();
    if(c.equals(a))x--;
    else y--;
    System.out.print(x+" "+y);
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String a=sc.next(); a sc.next() sc.next sc String b=sc.next(); b sc.next() sc.next sc int x=sc.nextInt(); x sc.nextInt() sc.nextInt sc int y=sc.nextInt(); y sc.nextInt() sc.nextInt sc String c=sc.next(); c sc.next() sc.next sc if(c.equals(a))x--;
    else y--; c.equals(a) c.equals c a x-- x y-- y System.out.print(x+" "+y) System.out.print System.out System System.out x+" "+y x+" "+y x " " y String[]args args
import java.util.*;
class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String a=sc.next();
    String b=sc.next();
    int x=sc.nextInt();int y=sc.nextInt();
    String c=sc.next();
    if(c.equals(a))x--;
    else y--;
    System.out.print(x+" "+y);
  }
}
