/*
    Those who cannot remember the past are condemned to repeat it.
                                            - Dynamic Programming
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st; st PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) String s1 = st.nextToken(); s1 st.nextToken() st.nextToken st String s2 = st.nextToken(); s2 st.nextToken() st.nextToken st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) int a = Integer.parseInt(st.nextToken()); a Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int b = Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st String u = br.readLine(); u br.readLine() br.readLine br if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        } u.equals(s1) u.equals u s1 {
            a--;
        } a-- a {
            b--;
        } b-- b pw.println(a + " " + b) pw.println pw a + " " + b a + " " + b a " " b pw.flush() pw.flush pw pw.close() pw.close pw String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
} Main
/*
    Those who cannot remember the past are condemned to repeat it.
                                            - Dynamic Programming
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        st = new StringTokenizer(br.readLine());
        String s1 = st.nextToken();
        String s2 = st.nextToken();
        st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        String u = br.readLine();
        if(u.equals(s1)) {
            a--;
        }
        else {
            b--;
        }

        pw.println(a + " " + b);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
}
