import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int a=sc.nextInt();
        int b=sc.nextInt();
        String ans=sc.next();
        int sum=0;

        if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        }
        if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int a=sc.nextInt();
        int b=sc.nextInt();
        String ans=sc.next();
        int sum=0;

        if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        }
        if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        }
        sc.close();
    }
} Main public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int a=sc.nextInt();
        int b=sc.nextInt();
        String ans=sc.next();
        int sum=0;

        if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        }
        if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        }
        sc.close();
    } main {
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int a=sc.nextInt();
        int b=sc.nextInt();
        String ans=sc.next();
        int sum=0;

        if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        }
        if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        }
        sc.close();
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc String ans=sc.next(); ans sc.next() sc.next sc int sum=0; sum 0 if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        } ans.equals(s) ans.equals ans s {
            sum=a-1;
            System.out.println(sum+" "+b);
        } sum=a-1 sum a-1 a 1 System.out.println(sum+" "+b) System.out.println System.out System System.out sum+" "+b sum+" "+b sum " " b if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        } ans.equals(t) ans.equals ans t {
            sum=b-1;
            System.out.println(a+" "+sum);
        } sum=b-1 sum b-1 b 1 System.out.println(a+" "+sum) System.out.println System.out System System.out a+" "+sum a+" "+sum a " " sum sc.close() sc.close sc String args[] args
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int a=sc.nextInt();
        int b=sc.nextInt();
        String ans=sc.next();
        int sum=0;

        if(ans.equals(s)){
            sum=a-1;
            System.out.println(sum+" "+b);
        }
        if(ans.equals(t)){
            sum=b-1;
            System.out.println(a+" "+sum);
        }
        sc.close();
    }
}