import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    }
} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    } Scanner scan = new Scanner(is); scan new Scanner(is) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan String u = scan.next(); u scan.next() scan.next scan if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        } s.equals(u) s.equals s u {
            os.println((a-1) + " " + b);
        } os.println((a-1) + " " + b) os.println os (a-1) + " " + b (a-1) + " " + b (a-1) a 1 " " b {
            os.println(a + " " + (b-1));
        } os.println(a + " " + (b-1)) os.println os a + " " + (b-1) a + " " + (b-1) a " " (b-1) b 1 InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();

        if(s.equals(u)){
            os.println((a-1) + " " + b);
        } else {
            os.println(a + " " + (b-1));
        }
    }
}