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