import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    }
} Main public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    } main {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.next(); s stdIn.next() stdIn.next stdIn String t = stdIn.next(); t stdIn.next() stdIn.next stdIn int a = stdIn.nextInt(); a stdIn.nextInt() stdIn.nextInt stdIn int b = stdIn.nextInt(); b stdIn.nextInt() stdIn.nextInt stdIn String u = stdIn.next(); u stdIn.next() stdIn.next stdIn if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        } s.equals(u) s.equals s u {
            System.out.println(a - 1 + " " + b);
        } System.out.println(a - 1 + " " + b) System.out.println System.out System System.out a - 1 + " " + b a - 1 + " " + b a - 1 a 1 " " b {
            System.out.println(a + " " + (b - 1));
        } System.out.println(a + " " + (b - 1)) System.out.println System.out System System.out a + " " + (b - 1) a + " " + (b - 1) a " " (b - 1) b 1 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String t = stdIn.next();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        String u = stdIn.next();
        
        if(s.equals(u)){
            System.out.println(a - 1 + " " + b);
        }else{
            System.out.println(a + " " + (b - 1));
        }
        
    }
} Main
import java.util.*;

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