import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int sb = scan.nextInt();
        int tb = scan.nextInt();
        String u = scan.next();
        scan.close();

        if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--;

        System.out.println(sb + " " + tb);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int sb = scan.nextInt();
        int tb = scan.nextInt();
        String u = scan.next();
        scan.close();

        if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--;

        System.out.println(sb + " " + tb);
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int sb = scan.nextInt();
        int tb = scan.nextInt();
        String u = scan.next();
        scan.close();

        if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--;

        System.out.println(sb + " " + tb);
    } main {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int sb = scan.nextInt();
        int tb = scan.nextInt();
        String u = scan.next();
        scan.close();

        if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--;

        System.out.println(sb + " " + tb);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int sb = scan.nextInt(); sb scan.nextInt() scan.nextInt scan int tb = scan.nextInt(); tb scan.nextInt() scan.nextInt scan String u = scan.next(); u scan.next() scan.next scan scan.close() scan.close scan if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--; s.equals(u) s.equals s u sb-- sb if(t.equals(u)) tb--; t.equals(u) t.equals t u tb-- tb System.out.println(sb + " " + tb) System.out.println System.out System System.out sb + " " + tb sb + " " + tb sb " " tb String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int sb = scan.nextInt();
        int tb = scan.nextInt();
        String u = scan.next();
        scan.close();

        if(s.equals(u)) sb--;
        else if(t.equals(u)) tb--;

        System.out.println(sb + " " + tb);
    }
}