import java.util.*;
 
public class Main
{
  public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  }
} import java.util.*; util.* java public class Main
{
  public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  }
} Main public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  } main {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  } Scanner scan1 = new Scanner(System.in); scan1 new Scanner(System.in) String firstColor = scan1.next(); firstColor scan1.next() scan1.next scan1 String secondColor = scan1.next(); secondColor scan1.next() scan1.next scan1 scan1.nextLine() scan1.nextLine scan1 int redCount = scan1.nextInt(); redCount scan1.nextInt() scan1.nextInt scan1 int blueCount = scan1.nextInt(); blueCount scan1.nextInt() scan1.nextInt scan1 String subtract = scan1.next(); subtract scan1.next() scan1.next scan1 if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    } subtract.equals(firstColor) subtract.equals subtract firstColor {
 	 redCount-=1;
	} redCount-=1 redCount 1 {
 	 blueCount-=1;
    } blueCount-=1 blueCount 1 System.out.println(redCount + " " + blueCount) System.out.println System.out System System.out redCount + " " + blueCount redCount + " " + blueCount redCount " " blueCount String[] args args public class Main
{
  public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  }
} public class Main
{
  public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  }
} Main
import java.util.*;
 
public class Main
{
  public static void main(String[] args)
  {
    Scanner scan1 = new Scanner(System.in);
	String firstColor = scan1.next();
    String secondColor = scan1.next();
    
    scan1.nextLine();
 
	int redCount = scan1.nextInt();
	int blueCount = scan1.nextInt();
 
	String subtract = scan1.next();
 
	if(subtract.equals(firstColor))
	{
 	 redCount-=1;
	}
	else
    {
 	 blueCount-=1;
    }
 
	System.out.println(redCount + " " + blueCount);
  }
}