
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	}

} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	} main {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String x=sc.next(); x sc.next() sc.next sc String y=sc.next(); y sc.next() sc.next sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int h=sc.nextInt(); h sc.nextInt() sc.nextInt sc String s=sc.next(); s sc.next() sc.next sc if(s.equals(y))
			h--;
		else
			n--; s.equals(y) s.equals s y h-- h n-- n System.out.println(n+" "+h) System.out.println System.out System System.out n+" "+h n+" "+h n " " h String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	}

} Main

import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String x=sc.next();
		String y=sc.next();
		int n=sc.nextInt();
		int h=sc.nextInt();
		String s=sc.next();
		if(s.equals(y))
			h--;
		else
			n--;
		System.out.println(n+" "+h);




	}

}
