import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        } 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 numS = Integer.parseInt(sc.next()); numS Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int numT = Integer.parseInt(sc.next()); numT 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)){
            numS--;
        }else{
            numT--;
        } U.equals(S) U.equals U S {
            numS--;
        } numS-- numS {
            numT--;
        } numT-- numT System.out.println(numS + " " + numT) System.out.println System.out System System.out numS + " " + numT numS + " " + numT numS " " numT String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int numS = Integer.parseInt(sc.next());
        int numT = Integer.parseInt(sc.next());
        String U = sc.next();
        if(U.equals(S)){
            numS--;
        }else{
            numT--;
        }
        System.out.println(numS + " " + numT);
        }
}
