import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    }
} import java.io.InputStream; InputStream java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Solver solver = new Solver(); solver new Solver() solver.solve(in, out) solver.solve solver in out out.close() out.close out String[] args args static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    } Solver public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        } solve {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        } String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in int A = in.nextInt(); A in.nextInt() in.nextInt in int B = in.nextInt(); B in.nextInt() in.nextInt in String U = in.next(); U in.next() in.next in if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            } S.equals(U) S.equals S U {
                A--;
            } A-- A {
                B--;
            } B-- B out.println(A + " " + B) out.println out A + " " + B A + " " + B A " " B Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    }
} Main
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String S = in.next();
            String T = in.next();
            int A = in.nextInt();
            int B = in.nextInt();
            String U = in.next();
            
            if (S.equals(U)) {
                A--;
            }
            else {
                B--;
            }
            out.println(A + " " + B);
        }
    }
}