
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	}
} Main public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	} main {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	} Scanner w = new Scanner ( System.in) ; w new Scanner ( System.in) String s = w.next(); s w.next() w.next w String t = w.next(); t w.next() w.next w int a = w.nextInt(); a w.nextInt() w.nextInt w int b = w.nextInt(); b w.nextInt() w.nextInt w String u = w.next(); u w.next() w.next w if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	} u.equals(s) u.equals u s {
		a = a-1;
	} a = a-1 a a-1 a 1 if (u.equals(t) ) { 
		b = b-1;
	} u.equals(t) u.equals u t { 
		b = b-1;
	} b = b-1 b b-1 b 1 System.out.print(a + " "+ b) System.out.print System.out System System.out a + " "+ b a + " "+ b a " " b String[] args args public class Main {

	public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	}
} public class Main {

	public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	}
} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
	Scanner w = new Scanner ( System.in) ;
	String s = w.next();;
	String t = w.next();
	int a = w.nextInt();
	
	int b = w.nextInt();
	
	String u = w.next();
	
	
	if (u.equals(s) ) {
		a = a-1;
	}
	else if (u.equals(t) ) { 
		b = b-1;
	}
	System.out.print(a + " "+ b);
	}
}
