import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s1 = sc.nextLine().split(" "); s1 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc String next = sc.next(); next sc.next() sc.next sc a = s1[0].equals(next) ? a - 1 : a a s1[0].equals(next) ? a - 1 : a s1[0].equals(next) s1[0].equals s1[0] s1 0 next a - 1 a 1 a b = s1[1].equals(next) ? b - 1 : b b s1[1].equals(next) ? b - 1 : b s1[1].equals(next) s1[1].equals s1[1] s1 1 next b - 1 b 1 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) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s1 = sc.nextLine().split(" ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        String next = sc.next();
 
        a = s1[0].equals(next) ? a - 1 : a;
        b = s1[1].equals(next) ? b - 1 : b;
        System.out.println(a + " " + b);
    }
}