import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    }
} import java.util.Objects; Objects java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    } 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 int sb = sc.nextInt(); sb sc.nextInt() sc.nextInt sc int tb = sc.nextInt(); tb sc.nextInt() sc.nextInt sc String deleteBall = sc.next(); deleteBall sc.next() sc.next sc if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        } Objects.equals(s, deleteBall) Objects.equals Objects s deleteBall {
            sb = sb -1;
        } sb = sb -1 sb sb -1 sb 1 if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        } Objects.equals(t, deleteBall) Objects.equals Objects t deleteBall {
            tb = tb -1;
        } tb = tb -1 tb tb -1 tb 1 System.out.println(sb + " " + tb) System.out.println System.out System System.out sb + " " + tb sb + " " + tb sb " " tb 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();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    }
} Main
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sb = sc.nextInt();
        int tb = sc.nextInt();
        String deleteBall = sc.next();
        if (Objects.equals(s, deleteBall)) {
            sb = sb -1;
        } else if (Objects.equals(t, deleteBall)) {
            tb = tb -1;
        }
        System.out.println(sb + " " + tb);
    }
}