
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    }
} Main public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    } main {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String t = scanner.next(); t scanner.next() scanner.next scanner int a = Integer.parseInt(scanner.next()); a Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int b = Integer.parseInt(scanner.next()); b Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner String u = scanner.next(); u scanner.next() scanner.next scanner 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 +" " b a + " " + b +" " a " " b " " String[] args args public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    }
} public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    }
} Main

import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int a = Integer.parseInt(scanner.next());
        int b = Integer.parseInt(scanner.next());
        String u = scanner.next();

        if (s.equals(u)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b +" ");
    }
}