import java.util.*;

public class Main{
  public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  }
}

class Solve{
  public Solve(String s, String t, String u, int a, int b){
    System.out.println(s.equals(u)?--a+" "+b:a+" "+--b);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  }
} Main public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc String u=sc.next(); u sc.next() sc.next sc sc.close() sc.close sc Solve solve = new Solve(s, t, u, a, b); solve new Solve(s, t, u, a, b) String[]$ $ class Solve{
  public Solve(String s, String t, String u, int a, int b){
    System.out.println(s.equals(u)?--a+" "+b:a+" "+--b);
  }
} Solve public Solve(String s, String t, String u, int a, int b){
    System.out.println(s.equals(u)?--a+" "+b:a+" "+--b);
  } Solve {
    System.out.println(s.equals(u)?--a+" "+b:a+" "+--b);
  } System.out.println(s.equals(u)?--a+" "+b:a+" "+--b) System.out.println System.out System System.out s.equals(u)?--a+" "+b:a+" "+--b s.equals(u) s.equals s u --a+" "+b --a+" "+b --a a " " b a+" "+--b a+" "+--b a " " --b b String s s String t t String u u int a a int b b public class Main{
  public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  }
} public class Main{
  public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[]$){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a=sc.nextInt();
    int b=sc.nextInt();
    String u=sc.next();
    sc.close();
    Solve solve = new Solve(s, t, u, a, b);
  }
}

class Solve{
  public Solve(String s, String t, String u, int a, int b){
    System.out.println(s.equals(u)?--a+" "+b:a+" "+--b);
  }
}
