import org.w3c.dom.ls.LSOutput;

import java.util.Scanner;

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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            A--;
        } else {
            B--;
        }
        System.out.println(A + " " + B);
    }
} import org.w3c.dom.ls.LSOutput; LSOutput org.w3c.dom.ls import java.util.Scanner; Scanner 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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            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 = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner String U = scanner.next(); U scanner.next() scanner.next scanner if(U.equals(S)) {
            A--;
        } else {
            B--;
        } U.equals(S) U.equals U S {
            A--;
        } A-- A {
            B--;
        } B-- 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 scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            A--;
        } else {
            B--;
        }
        System.out.println(A + " " + B);
    }
} Main
import org.w3c.dom.ls.LSOutput;

import java.util.Scanner;

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 = scanner.nextInt();
        int B = scanner.nextInt();
        String U = scanner.next();
        if(U.equals(S)) {
            A--;
        } else {
            B--;
        }
        System.out.println(A + " " + B);
    }
}
