import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  } main {
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String a1 = scan.next(); a1 scan.next() scan.next scan String a2 = scan.next(); a2 scan.next() scan.next scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan String a3 = scan.next(); a3 scan.next() scan.next scan if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    } a1.equals(a3) a1.equals a1 a3 {
      n -= 1;
    } n -= 1 n 1 {
      m -= 1;
    } m -= 1 m 1 System.out.print(n+" ") System.out.print System.out System System.out n+" " n " " System.out.println(m) System.out.println System.out System System.out m String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a1 = scan.next();
    String a2 = scan.next();
    int n = scan.nextInt();
    int m = scan.nextInt();
    String a3 = scan.next();
    if (a1.equals(a3)){
      n -= 1;
    }
    else{
      m -= 1;
    }
    System.out.print(n+" ");
    System.out.println(m);

  }
}
