import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        }
    } import java.util.Scanner; Scanner java.util public class Main
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        }
    } Main public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        } main {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        } Scanner s = new Scanner(System.in); s new Scanner(System.in) String S = s.next(); S s.next() s.next s String T = s.next(); T s.next() s.next s int A = s.nextInt(); A s.nextInt() s.nextInt s int B = s.nextInt(); B s.nextInt() s.nextInt s String U = s.next(); U s.next() s.next s if(U.equalsIgnoreCase(S))
            A--;
        else
            B--; U.equalsIgnoreCase(S) U.equalsIgnoreCase U S A-- A 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 s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        }
    } public class Main
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        }
    } Main
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        int A = s.nextInt();
        int B = s.nextInt();
        String U = s.next();
        if(U.equalsIgnoreCase(S))
            A--;
        else
            B--;
        System.out.println(A+" "+B);
        }
    }