
import java.util.*;

public class Main{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        }
    
} import java.util.*; util.* java public class Main{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        }
    
} Main public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        } main {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s1=sc.next(); s1 sc.next() sc.next sc String s2=sc.next(); s2 sc.next() sc.next sc long a1=sc.nextLong(); a1 sc.nextLong() sc.nextLong sc long a2=sc.nextLong(); a2 sc.nextLong() sc.nextLong sc String s3=sc.next(); s3 sc.next() sc.next sc if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        } s3.equals(s1) s3.equals s3 s1 {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        } a1=a1-1 a1 a1-1 a1 1 System.out.println(a1) System.out.println System.out System System.out a1 System.out.println(a2) System.out.println System.out System System.out a2 {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        } a2=a2-1 a2 a2-1 a2 1 System.out.println(a1) System.out.println System.out System System.out a1 System.out.println(a2) System.out.println System.out System System.out a2 sc.close() sc.close sc String args[] args public class Main{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        }
    
} public class Main{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        }
    
} Main

import java.util.*;

public class Main{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);     
        String s1=sc.next();
        String s2=sc.next();
        long a1=sc.nextLong();
        long a2=sc.nextLong();
        String s3=sc.next();
        if(s3.equals(s1))
        {
        	a1=a1-1;
        	System.out.println(a1);
        	System.out.println(a2);
        	
        }
        else
        {

        	a2=a2-1;
        	System.out.println(a1);
        	System.out.println(a2);
        


        }
        sc.close();
       



        }
    
}