import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    }
} Main public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    } main {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc int cnt1 = sc.nextInt(); cnt1 sc.nextInt() sc.nextInt sc int cnt2 = sc.nextInt(); cnt2 sc.nextInt() sc.nextInt sc String s3 = sc.next(); s3 sc.next() sc.next sc sc.close() sc.close sc if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	} s.equals(s3) s.equals s s3 {
    		cnt1--;
    	} cnt1-- cnt1 {
    		cnt2--;
    	} cnt2-- cnt2 System.out.println(cnt1 + " " + cnt2) System.out.println System.out System System.out cnt1 + " " + cnt2 cnt1 + " " + cnt2 cnt1 " " cnt2 String[] args args public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    }
} public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
    	String s2 = sc.next();
    	int cnt1 = sc.nextInt();
    	int cnt2 = sc.nextInt();
    	String s3 = sc.next();
    	sc.close();
    	if(s.equals(s3)){
    		cnt1--;
    	}else{
    		cnt2--;
    	}
    	System.out.println(cnt1 + " " + cnt2);
    }
}