import java.util.Scanner;
import java.util.LinkedList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Collections;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),
            t = sc.next();
        int a=sc.nextInt(),
            b=sc.nextInt();
        String u = sc.next();

        sc.close();
        if(u.equals(s)){
            a--;
        }else{
            b--;
        }
        System.out.print(a+" "+b);
        
    }
} import java.util.Scanner; Scanner java.util import java.util.LinkedList; LinkedList java.util import java.lang.Math; Math java.lang import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),
            t = sc.next();
        int a=sc.nextInt(),
            b=sc.nextInt();
        String u = sc.next();

        sc.close();
        if(u.equals(s)){
            a--;
        }else{
            b--;
        }
        System.out.print(a+" "+b);
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),
            t = sc.next();
        int a=sc.nextInt(),
            b=sc.nextInt();
        String u = sc.next();

        sc.close();
        if(u.equals(s)){
            a--;
        }else{
            b--;
        }
        System.out.print(a+" "+b);
        
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),
            t = sc.next();
        int a=sc.nextInt(),
            b=sc.nextInt();
        String u = sc.next();

        sc.close();
        if(u.equals(s)){
            a--;
        }else{
            b--;
        }
        System.out.print(a+" "+b);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next() s sc.next() sc.next sc t = sc.next(); t sc.next() sc.next sc int a=sc.nextInt() a sc.nextInt() sc.nextInt sc b=sc.nextInt(); b sc.nextInt() sc.nextInt sc String u = sc.next(); u sc.next() sc.next sc sc.close() sc.close sc if(u.equals(s)){
            a--;
        }else{
            b--;
        } u.equals(s) u.equals u s {
            a--;
        } a-- a {
            b--;
        } b-- b System.out.print(a+" "+b) System.out.print System.out System System.out a+" "+b a+" "+b a " " b String[] args args
import java.util.Scanner;
import java.util.LinkedList;
import java.lang.Math;
import java.util.Arrays;
import java.util.Collections;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),
            t = sc.next();
        int a=sc.nextInt(),
            b=sc.nextInt();
        String u = sc.next();

        sc.close();
        if(u.equals(s)){
            a--;
        }else{
            b--;
        }
        System.out.print(a+" "+b);
        
    }
}