


import java.io.*;
import java.util.*;


public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
} Main static int  mod= (int) (1e9+7); mod (int) (1e9+7) 1e9 7 static long memo[][]; memo static long inf= (long) 2e9; inf (long) 2e9 static int[]cost cost weight; weight static ArrayList<Integer> primes; primes static int[] isComposite; isComposite public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    } ciel {
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    } long res=x/y; res x/y x y if(x%y!=0)res++; x%y!=0 x%y x y 0 res++ res return res; res long x x long y y public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    } gcd {
        if(v==0)return u;
        return gcd(v, u%v);
    } if(v==0)return u; v==0 v 0 return u; u return gcd(v, u%v); gcd(v, u%v) gcd v u%v u v long u u long v v static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    } primeFactors {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    } ArrayList<Integer> factors = new ArrayList<Integer>(); factors new ArrayList<Integer>() int idx = 0 idx 0 p = primes.get(idx); p primes.get(idx) primes.get primes idx while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        } p * p <= N p * p p p N {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        } while(N % p == 0) { factors.add(p); N /= p; } N % p == 0 N % p N p 0 { factors.add(p); N /= p; } factors.add(p) factors.add factors p N /= p N p p = primes.get(++idx) p primes.get(++idx) primes.get primes ++idx idx if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1 N != 1 N 1 factors.add(N) factors.add factors N return factors; factors int N N static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    } sieve {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    } isComposite = new int[N+1] isComposite new int[N+1] N+1 N 1 isComposite[0] = isComposite[1] = 1 isComposite[0] isComposite 0 isComposite[1] = 1 isComposite[1] isComposite 1 1 primes = new ArrayList<Integer>() primes new ArrayList<Integer>() for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            } int i = 2; int i = 2; i 2 i <= N i N ++i ++i i if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            } if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            } isComposite[i] == 0 isComposite[i] isComposite i 0 {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            } primes.add(i) primes.add primes i if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1; 1l * i * i <= N 1l * i * i 1l * i * i 1l i i N for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1; int j = i * i; int j = i * i; j i * i i i j <= N j N j += i j += i j i isComposite[j] = 1; isComposite[j] = 1 isComposite[j] isComposite j 1 int N N /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    } isPrime {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    } if(N < isComposite.length)
            return isComposite[N] == 0; N < isComposite.length N isComposite.length isComposite isComposite.length return isComposite[N] == 0; isComposite[N] == 0 isComposite[N] isComposite N 0 for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false; int p primes if(N%p==0)
                return false; if(N%p==0)
                return false; N%p==0 N%p N p 0 return false; false return true; true int N N static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    } modPow {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    } a %= mod a mod long res = 1; res 1 while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        } e > 0 e 0 {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        } if((e & 1) == 1)
                res = (res * a) % mod; (e & 1) == 1 (e & 1) e 1 1 res = (res * a) % mod res (res * a) % mod (res * a) res a mod a = (a * a) % mod a (a * a) % mod (a * a) a a mod e >>= 1 e 1 return res; res long a a long e e long mod mod public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    } main {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) PrintWriter pw=new PrintWriter(System.out); pw new PrintWriter(System.out) String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int m=sc.nextInt(); m sc.nextInt() sc.nextInt sc String u=sc.next(); u sc.next() sc.next sc if(u.equals(s)){
            n--;
        }else m--; u.equals(s) u.equals u s {
            n--;
        } n-- n m-- m pw.println(n+" "+m) pw.println pw n+" "+m n+" "+m n " " m pw.close() pw.close pw String[] args args static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        } pair int x; x int idx; idx pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        } pair {
            this.x=x;
            this.idx=idx;
        } this.x=x this.x this this.x x this.idx=idx this.idx this this.idx idx int x x int idx idx @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        } compareTo {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        } if(p.x==x){
                return idx-p.idx;
            } p.x==x p.x p p.x x {
                return idx-p.idx;
            } return idx-p.idx; idx-p.idx idx p.idx p p.idx return x-p.x; x-p.x x p.x p p.x pair p p Comparable public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    } Scanner StringTokenizer st; st BufferedReader br; br public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        } Scanner {
            br = new BufferedReader(new InputStreamReader(s));
        } br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String nextLine() throws IOException {
            return br.readLine();
        } nextLine {
            return br.readLine();
        } return br.readLine(); br.readLine() br.readLine br public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        } nextDouble {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        } String x = next(); x next() next StringBuilder sb = new StringBuilder("0"); sb new StringBuilder("0") double res = 0 res 0 f = 1; f 1 boolean dec = false dec false neg = false; neg false int start = 0; start 0 if (x.charAt(0) == '-') {
                neg = true;
                start++;
            } x.charAt(0) == '-' x.charAt(0) x.charAt x 0 '-' {
                neg = true;
                start++;
            } neg = true neg true start++ start for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } int i = start; int i = start; i start i < x.length() i x.length() x.length x i++ i++ i if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } x.charAt(i) == '.' x.charAt(i) x.charAt x i '.' {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } res = Long.parseLong(sb.toString()) res Long.parseLong(sb.toString()) Long.parseLong Long sb.toString() sb.toString sb sb = new StringBuilder("0") sb new StringBuilder("0") dec = true dec true {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } sb.append(x.charAt(i)) sb.append sb x.charAt(i) x.charAt x i if (dec)
                        f *= 10; dec f *= 10 f 10 res += Long.parseLong(sb.toString()) / f res Long.parseLong(sb.toString()) / f Long.parseLong(sb.toString()) Long.parseLong Long sb.toString() sb.toString sb f return res * (neg ? -1 : 1); res * (neg ? -1 : 1) res (neg ? -1 : 1) neg -1 1 1 public boolean ready() throws IOException, IOException {
            return br.ready();
        } ready {
            return br.ready();
        } return br.ready(); br.ready() br.ready br public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
} public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
} Main



import java.io.*;
import java.util.*;


public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        String s=sc.next();
        String t=sc.next();
        int n=sc.nextInt();
        int m=sc.nextInt();
        String u=sc.next();
        if(u.equals(s)){
            n--;
        }else m--;
        pw.println(n+" "+m);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}