import java.util.Scanner;


public class Main {
  public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  }
} Main public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  } main {
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] line = scan.nextLine().split(" "); line scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " String s = line[0]; s line[0] line 0 String t = line[1]; t line[1] line 1 String[] line2 = scan.nextLine().split(" "); line2 scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int a = Integer.parseInt(line2[0]); a Integer.parseInt(line2[0]) Integer.parseInt Integer line2[0] line2 0 int b = Integer.parseInt(line2[1]); b Integer.parseInt(line2[1]) Integer.parseInt Integer line2[1] line2 1 String u = scan.nextLine(); u scan.nextLine() scan.nextLine scan if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    } u.equals(s) u.equals u s {
      a = a - 1;
    } a = a - 1 a a - 1 a 1 {
      b = b - 1;
    } b = b - 1 b b - 1 b 1 System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] arg arg public class Main {
  public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  }
} public class Main {
  public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  }
} Main
import java.util.Scanner;


public class Main {
  public static void main(String[] arg){
    // input
    Scanner scan = new Scanner(System.in);
    String[] line = scan.nextLine().split(" ");
    String s = line[0];
    String t = line[1];
    String[] line2 = scan.nextLine().split(" ");
    int a = Integer.parseInt(line2[0]);
    int b = Integer.parseInt(line2[1]);
    String u = scan.nextLine();


    // condition process
    if(u.equals(s)){
      a = a - 1;
    }else{
      b = b - 1;
    }

    // output
    System.out.println(a + " " + b);

  }
}
