import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    } main {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line1 = sc.nextLine(); line1 sc.nextLine() sc.nextLine sc String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc String line3 = sc.nextLine(); line3 sc.nextLine() sc.nextLine sc String[] array1 = line1.split(" "); array1 line1.split(" ") line1.split line1 " " String[] array2 = line2.split(" "); array2 line2.split(" ") line2.split line2 " " String s = array1[0]; s array1[0] array1 0 String t = array1[1]; t array1[1] array1 1 String u = line3; u line3 int a = Integer.parseInt(array2[0]); a Integer.parseInt(array2[0]) Integer.parseInt Integer array2[0] array2 0 int b = Integer.parseInt(array2[1]); b Integer.parseInt(array2[1]) Integer.parseInt Integer array2[1] array2 1 if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        } s.equals(u) s.equals s u {
            a--;
        } a-- a {
            b--;
        } 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 Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line1 = sc.nextLine();
        String line2 = sc.nextLine();
        String line3 = sc.nextLine();
        
        String[] array1 = line1.split(" ");
        String[] array2 = line2.split(" ");
        
        String s = array1[0];
        String t = array1[1];
        String u = line3;
        
        int a = Integer.parseInt(array2[0]);
        int b = Integer.parseInt(array2[1]);
        
        if(s.equals(u))
        {
            a--;
        }
        else
        {
            b--;
        }
        
        System.out.println(a + " " + b);
    }
}
