import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    }
} Main public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    } main {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s1 = scan.next() s1 scan.next() scan.next scan s2 = scan.next(); s2 scan.next() scan.next scan int a = scan.nextInt() a scan.nextInt() scan.nextInt scan b = scan.nextInt(); b scan.nextInt() scan.nextInt scan String s3 = scan.next(); s3 scan.next() scan.next scan if (s3.equals(s1))
            a --;
        else
            b --; s3.equals(s1) s3.equals s3 s1 a -- a b -- b System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String s1 = scan.next(), s2 = scan.next();
        int a = scan.nextInt(), b = scan.nextInt();
        String s3 = scan.next();
        if (s3.equals(s1))
            a --;
        else
            b --;
        System.out.println(a + " " + b);
    }
}
