import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    }
} Main public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    } main {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.next(); s1 sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc int cnt1 = sc.nextInt(); cnt1 sc.nextInt() sc.nextInt sc int cnt2 = sc.nextInt(); cnt2 sc.nextInt() sc.nextInt sc if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--; sc.next().equals(s1) sc.next().equals sc.next() sc.next sc s1 cnt1-- cnt1 cnt2-- cnt2 System.out.println(cnt1 + " " + cnt2) System.out.println System.out System System.out cnt1 + " " + cnt2 cnt1 + " " + cnt2 cnt1 " " cnt2 String args[] args public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    }
} public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int cnt1 = sc.nextInt();
        int cnt2 = sc.nextInt();
        if(sc.next().equals(s1))
        	cnt1--;
        else
        	cnt2--;
        System.out.println(cnt1 + " " + cnt2);
    }
}
