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