import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
} Main public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] words = br.readLine().split(" "); words br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String[] numStr = br.readLine().split(" "); numStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] num = new int[2]; num new int[2] 2 num[0] = Integer.parseInt(numStr[0]) num[0] num 0 Integer.parseInt(numStr[0]) Integer.parseInt Integer numStr[0] numStr 0 num[1] = Integer.parseInt(numStr[1]) num[1] num 1 Integer.parseInt(numStr[1]) Integer.parseInt Integer numStr[1] numStr 1 String took = br.readLine(); took br.readLine() br.readLine br if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    } took.equals(words[0]) took.equals took words[0] words 0 {
      num[0]--;
    } num[0]-- num[0] num 0 {
      num[1]--;
    } num[1]-- num[1] num 1 System.out.println(num[0] + " " + num[1]) System.out.println System.out System System.out num[0] + " " + num[1] num[0] + " " + num[1] num[0] num 0 " " num[1] num 1 String[] args args public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
} public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
}