import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    }
} Main public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    } main {
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






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

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    }
} public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    }
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();

        if(u.equals(s)){
            a -= 1;
        }else{
            b -= 1;
        }
        System.out.print(a + " " + b);
        
        






    }
}