import static java.lang.Math.max;
import static java.lang.Math.min;
import java.util.Scanner;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  }
} import static java.lang.Math.max; import static java.lang.Math.max; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.min; import static java.lang.Math.min; import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  } main {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final String s = scanner.next(); s scanner.next() scanner.next scanner final String t = scanner.next(); t scanner.next() scanner.next scanner final int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner final int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner final String u = scanner.next(); u scanner.next() scanner.next scanner if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    } u.equals(s) u.equals u s {
      System.out.println((a-1) + " " + b);
    } System.out.println((a-1) + " " + b) System.out.println System.out System System.out (a-1) + " " + b (a-1) + " " + b (a-1) a 1 " " b {
      System.out.println(a + " " + (b-1));
    } System.out.println(a + " " + (b-1)) System.out.println System.out System System.out a + " " + (b-1) a + " " + (b-1) a " " (b-1) b 1 String[] args args public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  }
} public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  }
} Main
import static java.lang.Math.max;
import static java.lang.Math.min;
import java.util.Scanner;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final String s = scanner.next();
    final String t = scanner.next();
    final int a = scanner.nextInt();
    final int b = scanner.nextInt();
    final String u = scanner.next();

    if(u.equals(s)) {
      System.out.println((a-1) + " " + b);
    } else {
      System.out.println(a + " " + (b-1));
    }

  }
}
