/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	} main {
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String a = scan.next(); a scan.next() scan.next scan String b = scan.next(); b scan.next() scan.next scan int a_n = scan.nextInt(); a_n scan.nextInt() scan.nextInt scan int b_n = scan.nextInt(); b_n scan.nextInt() scan.nextInt scan String u = scan.next(); u scan.next() scan.next scan if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		} a.equals(u) a.equals a u {
			a_n-=1;
		} a_n-=1 a_n 1 {
			b_n-=1;
		} b_n-=1 b_n 1 System.out.println(a_n +" "+b_n) System.out.println System.out System System.out a_n +" "+b_n a_n +" "+b_n a_n " " b_n String[] args args public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	}
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	}
} Main
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		int a_n = scan.nextInt();
		int b_n = scan.nextInt();
		String u = scan.next();
		if(a.equals(u)){
			a_n-=1;
		}else {
			b_n-=1;
		}
		System.out.println(a_n +" "+b_n);
		// your code goes here
	}
}