import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


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

    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


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


    } main {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


    } Scanner sc=new Scanner(new BufferedInputStream(System.in)); sc new Scanner(new BufferedInputStream(System.in)) String a=sc.next(); a sc.next() sc.next sc String b=sc.next(); b sc.next() sc.next sc int x=sc.nextInt(); x sc.nextInt() sc.nextInt sc int y=sc.nextInt(); y sc.nextInt() sc.nextInt sc String p=sc.next(); p sc.next() sc.next sc if(p.equals(a))
            x--; p.equals(a) p.equals p a x-- x if(p.equals(b))
            y--; p.equals(b) p.equals p b y-- y System.out.println(x+" "+y) System.out.println System.out System System.out x+" "+y x+" "+y x " " y String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


    }
} Main
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.next();
        String b=sc.next();
        int x=sc.nextInt();
        int y=sc.nextInt();
        String p=sc.next();
        if(p.equals(a))
            x--;
        if(p.equals(b))
            y--;
        System.out.println(x+" "+y);


    }
}
