namespace AtCoderCS
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using System.Linq;
    using static System.Console;
    using static System.Math;
    using static Macro;
    using static Library;

    class Program
    {
        void Solve()
        {
                var S = IN.String;
                var T = IN.String;
                var A = IN.Int;
                var B = IN.Int;
                var U = IN.String;
                WriteLine(
                    S == U ? $"{A-1} {B}"
                        : $"{A} {B - 1}"
                );
        }

        private SimpleInput IN = new SimpleInput();
        private SimpleOutput OUT = new SimpleOutput();

        void Stream()
        {
            Solve();
            OUT.Flush();
        }

        static void Main(string[] args)
            => new Program().Stream();
    }


    #region IO

    class SimpleInput
    {
        private string[] _nextBuffer;
        private int _bufferCnt;
        private readonly char[] _cs = new char[] {' ', '"', ','};

        public SimpleInput()
        {
            _nextBuffer = new string[0];
            _bufferCnt = 0;
        }

        string Next()
        {
            if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
            var st = ReadLine();
            while (st == string.Empty) st = ReadLine();
            if (st != null) _nextBuffer = st.Split(_cs, StringSplitOptions.RemoveEmptyEntries);
            _bufferCnt = 0;
            return _nextBuffer[_bufferCnt++];
        }

        public string String => Next();
        public char Char => char.Parse(String);
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
    }

    class SimpleOutput
    {
        private readonly StreamWriter _sw = new StreamWriter(OpenStandardOutput())
        {
#if DEBUG
            AutoFlush = true
#else
            AutoFlush = false
#endif
        };

        public SimpleOutput()
        {
            SetOut(_sw);
        }

        public void Flush() => Out.Flush();
    }

    #endregion

    #region MACRO

    static class Macro
    {
        public static void FOR(int a, int b, int n, Action<int> f)
        {
            for (int i = a; i < b; i += n) f(i);
        }

        public static void FOR(int a, int b, Action<int> f) => FOR(a, b, 1, f);
        public static void REP(int a, Action<int> f) => FOR(0, a, f);
    }

    #endregion

    #region Library

    static class Library
    {
        public static int BinarySearch(int ng, int ok, Func<int, bool> f)
        {
            while (Math.Abs(ok - ng) > 1)
            {
                var mid = (ok + ng) / 2;
                if (f(mid)) ok = mid;
                else ng = mid;
            }

            return ok;
        }

        public static int LowerBound<T>(IReadOnlyList<T> a, T x) where T : IComparable<T> =>
            BinarySearch(-1, a.Count, (m) => a[m].CompareTo(x) >= 0);

        public static int UpperBound<T>(IReadOnlyList<T> a, T x) where T : IComparable<T> =>
            BinarySearch(-1, a.Count(), (m) => a[m].CompareTo(x) > 0);
    }

    class UnionFind
    {
        private int[] data;

        public UnionFind(int n)
        {
            data = new int[n + 1];
            for (var i = 0; i < n + 1; ++i) data[i] = -1;
        }

        public void Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);
            if (x == y) return;
            if (data[y] < data[x]) Swap(ref x, ref y);
            data[x] += data[y];
            data[y] = x;
        }

        public bool Find(int x, int y) => Root(x) == Root(y);
        public int Root(int x) => data[x] < 0 ? x : Root(data[x]);
        public int Size(int x) => -data[Root(x)];

        private void Swap(ref int a, ref int b)
        {
            var tmp = b;
            b = a;
            a = tmp;
        }
    }

    #endregion
}

Measured memory_bytes: 13140