

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    Scanner sin=new Scanner(System.in);
	    String s1=sin.next();
	    String s2=sin.next();
	    int a1=sin.nextInt();
	    int a2=sin.nextInt();
	    String s3=sin.next();
	    if(s1.equals(s3)){
            System.out.println((a1-1)+" "+a2);
        }
	    else System.out.println(a1+" "+(a2-1));
    }
} import java.lang.reflect.Array; Array java.lang.reflect import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

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

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

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


import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    Scanner sin=new Scanner(System.in);
	    String s1=sin.next();
	    String s2=sin.next();
	    int a1=sin.nextInt();
	    int a2=sin.nextInt();
	    String s3=sin.next();
	    if(s1.equals(s3)){
            System.out.println((a1-1)+" "+a2);
        }
	    else System.out.println(a1+" "+(a2-1));
    }
}
