import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    }
} Main public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    } main {
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    } Scanner scan = new java.util.Scanner(System.in); scan new java.util.Scanner(System.in) 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)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        } s.equals(u) s.equals s u {
            a = a - 1;
            System.out.println(a + " " + b);
        } a = a - 1 a a - 1 a 1 System.out.println(a + " " + b) System.out.println System.out System System.out a + " " + b a + " " + b a " " b {
            b = b - 1;
            System.out.println(a + " " + b);
        } b = b - 1 b b - 1 b 1 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){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int a = scan.nextInt();
        int b = scan.nextInt();
        String u = scan.next();
        
        if(s.equals(u)){
            a = a - 1;
            System.out.println(a + " " + b);
        }else{
            b = b - 1;
            System.out.println(a + " " + b);
        }
    }
} Main
import java.util.*;

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