import java.util.*;

public class Main 
{
	public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
}
    } import java.util.*; util.* java public class Main 
{
	public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
}
    } Main public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
} main {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
} Scanner sc = new Scanner (System.in); sc new Scanner (System.in) String a=  sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc String result = sc.next(); result sc.next() sc.next sc if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        } a.equals(result) a.equals a result {
          c--;
          System.out.println(c + " " + d);
        } c-- c System.out.println(c + " " + d) System.out.println System.out System System.out c + " " + d c + " " + d c " " d {
          d--;
          System.out.println(c + " " + d);
        } d-- d System.out.println(c + " " + d) System.out.println System.out System System.out c + " " + d c + " " + d c " " d String[] args args public class Main 
{
	public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
}
    } public class Main 
{
	public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
}
    } Main
import java.util.*;

public class Main 
{
	public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String a=  sc.next();
        String b = sc.next();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String result = sc.next();
        if (a.equals(result)) {
          c--;
          System.out.println(c + " " + d);
        }
        else {
          d--;
          System.out.println(c + " " + d);
        }
}
    }