import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    }
 
} 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) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    }
 
} Main public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    } main {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) String inputStr = null; inputStr null String inputBallNum = null; inputBallNum null String inputSelectStr = null; inputSelectStr null try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } inputStr = br.readLine() inputStr br.readLine() br.readLine br inputBallNum = br.readLine() inputBallNum br.readLine() br.readLine br inputSelectStr = br.readLine() inputSelectStr br.readLine() br.readLine br br.close() br.close br String[] str = inputStr.split(" "); str inputStr.split(" ") inputStr.split inputStr " " String[] ball = inputBallNum.split(" "); ball inputBallNum.split(" ") inputBallNum.split inputBallNum " " int a = Integer.parseInt(ball[0]); a Integer.parseInt(ball[0]) Integer.parseInt Integer ball[0] ball 0 int b = Integer.parseInt(ball[1]); b Integer.parseInt(ball[1]) Integer.parseInt Integer ball[1] ball 1 if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        } str[0].equals(inputSelectStr) str[0].equals str[0] str 0 inputSelectStr {
          a--; 
        } a-- a if(str[1].equals(inputSelectStr)){
          b--;
        } str[1].equals(inputSelectStr) str[1].equals str[1] str 1 inputSelectStr {
          b--;
        } b-- b System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] args args public class Main {
 
    public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    }
 
} public class Main {
 
    public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    }
 
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
  
        String inputStr = null;
        String inputBallNum = null;
        String inputSelectStr = null;
      
        try {
            inputStr = br.readLine();
            inputBallNum = br.readLine();
            inputSelectStr = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 		String[] str = inputStr.split(" ");
 		String[] ball = inputBallNum.split(" ");
      	
		int a = Integer.parseInt(ball[0]);
		int b = Integer.parseInt(ball[1]);
      
      	if(str[0].equals(inputSelectStr)){
          a--; 
        }else if(str[1].equals(inputSelectStr)){
          b--;
        }
      System.out.println(a + " " + b);
      
    }
 
}
