
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    }
} Main public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    } main {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    } final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) String s = in.next().trim(); s in.next().trim() in.next().trim in.next() in.next in String t = in.next().trim(); t in.next().trim() in.next().trim in.next() in.next in int sCount = in.nextInt(); sCount in.nextInt() in.nextInt in int tCount = in.nextInt(); tCount in.nextInt() in.nextInt in String u = in.next(); u in.next() in.next in if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        } s.equals(u) s.equals s u {
            sCount -= 1;
        } sCount -= 1 sCount 1 {
            tCount -= 1;
        } tCount -= 1 tCount 1 System.out.println(sCount + " " + tCount) System.out.println System.out System System.out sCount + " " + tCount sCount + " " + tCount sCount " " tCount String[] args args public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    }
} public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    }
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = in.next().trim();
        String t = in.next().trim();
        int sCount = in.nextInt();
        int tCount = in.nextInt();
        String u = in.next();
        if (s.equals(u)) {
            sCount -= 1;
        } else {
            tCount -= 1;
        }
        System.out.println(sCount + " " + tCount);
    }
}
