import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
} import java.util.*; util.* java public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    } main {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    } String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String u = sc.next(); u sc.next() sc.next sc if(u.equals(s)) {
            --a;
        } else {
            --b;
        } u.equals(s) u.equals u s {
            --a;
        } --a a {
            --b;
        } --b b System.out.printf("%d %d", a, b) System.out.printf System.out System System.out "%d %d" a b String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
} Main
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
}