import java.util.*;
import javax.lang.model.util.ElementScanner6;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    }
} import java.util.*; util.* java import javax.lang.model.util.ElementScanner6; ElementScanner6 javax.lang.model.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    } main {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc long a = sc.nextLong(); a sc.nextLong() sc.nextLong sc long b = sc.nextLong(); b sc.nextLong() sc.nextLong 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 String out = Long.toString(a) + " " + Long.toString(b); out Long.toString(a) + " " + Long.toString(b) Long.toString(a) + " " + Long.toString(b) Long.toString(a) Long.toString Long a " " Long.toString(b) Long.toString Long b System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    }
} Main
import java.util.*;
import javax.lang.model.util.ElementScanner6;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String s = sc.next();
        String t = sc.next();
        long a = sc.nextLong();
        long b = sc.nextLong();
        String u = sc.next();

        // 処理
        if (u.equals(s)) {
            a--;
        } else {
            b--;
        }
        String out = Long.toString(a) + " " + Long.toString(b);

        // 出力
        System.out.println(out);
    }
}