import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  } main {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan String U = scan.next(); U scan.next() scan.next scan scan.close() scan.close scan System.out.print(S.equals(U) ? A-1 : A) System.out.print System.out System System.out S.equals(U) ? A-1 : A S.equals(U) S.equals S U A-1 A 1 A System.out.print(" ") System.out.print System.out System System.out " " System.out.println(S.equals(U) ? B : B-1) System.out.println System.out System System.out S.equals(U) ? B : B-1 S.equals(U) S.equals S U B B-1 B 1 String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    int A = scan.nextInt();
    int B = scan.nextInt();
    String U = scan.next();
    scan.close();

    System.out.print(S.equals(U) ? A-1 : A);
    System.out.print(" ");
    System.out.println(S.equals(U) ? B : B-1);
  }
}