import javax.swing.*;
import java.util.*;
import java.io.*;


public class Main {
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }
    public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    }

    public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    }






    public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    }


}






 import javax.swing.*; swing.* javax import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }
    public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    }

    public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    }






    public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    }


} Main public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    } gcd {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    } if (a == 1 || b == 1)
            return 1; a == 1 || b == 1 a == 1 a 1 b == 1 b 1 return 1; 1 if (a == 0)
            return b; a == 0 a 0 return b; b if (b == 0)
            return a; b == 0 b 0 return a; a return gcd(b % a, a); gcd(b % a, a) gcd b % a b a a int a a int b b public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    } main {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    } FastReader s = new FastReader(); s new FastReader() String str=s.next(); str s.next() s.next s String str1=s.next(); str1 s.next() s.next s int n1=s.nextInt(); n1 s.nextInt() s.nextInt s int n2=s.nextInt(); n2 s.nextInt() s.nextInt s String str2 = s.next(); str2 s.next() s.next s if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        } str2.equals(str) str2.equals str2 str {
            System.out.println(n1-1+" "+n2);
        } System.out.println(n1-1+" "+n2) System.out.println System.out System System.out n1-1+" "+n2 n1-1+" "+n2 n1-1 n1 1 " " n2 {
            System.out.println(n1 + " "+ (n2-1));
        } System.out.println(n1 + " "+ (n2-1)) System.out.println System.out System System.out n1 + " "+ (n2-1) n1 + " "+ (n2-1) n1 " " (n2-1) n2 1 String[] args args public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        } FastReader {
            br = new BufferedReader(new InputStreamReader(System.in));
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } nextLine {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        } String str = ""; str "" try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                str = br.readLine();
            } str = br.readLine() str br.readLine() br.readLine br return str; str int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    } pair int a; a int b; b pair(int p, int q) {
            a = p;
            b = q;
        } pair {
            a = p;
            b = q;
        } a = p a p b = q b q int p p int q q public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        } hashCode {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        } return new Integer(a).hashCode() * 31 + new Integer(b).hashCode(); new Integer(a).hashCode() * 31 + new Integer(b).hashCode() new Integer(a).hashCode() * 31 new Integer(a).hashCode() new Integer(a).hashCode new Integer(a) 31 new Integer(b).hashCode() new Integer(b).hashCode new Integer(b) public class Main {
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }
    public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    }

    public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    }






    public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    }


} public class Main {
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }
    public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    }

    public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    }






    public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    }


} Main
import javax.swing.*;
import java.util.*;
import java.io.*;


public class Main {
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }
    public class pair {
        int a;
        int b;

        pair(int p, int q) {
            a = p;
            b = q;
        }
        public int hashCode() {
            return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
        }
    }

    public static int gcd(int a, int b) {
        if (a == 1 || b == 1)
            return 1;
        if (a == 0)
            return b;
        if (b == 0)
            return a;
        return gcd(b % a, a);
    }






    public static void main(String[] args) {
        FastReader s = new FastReader();
        String str=s.next();
        String str1=s.next();
        int n1=s.nextInt();
        int n2=s.nextInt();
        String str2 = s.next();
        if(str2.equals(str))
        {
            System.out.println(n1-1+" "+n2);
        }
        else {
            System.out.println(n1 + " "+ (n2-1));
        }

    }


}







