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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val inp = Main.InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val solver = Main.TaskA()
    solver.solve(inp, out)
    out.close()
}

class Main {
    internal class TaskA {
        fun solve(inp: InputReader, out: PrintWriter) {
            val s1 = inp.next()
            val s2 = inp.next()
            var c1 = inp.nextInt()
            var c2 = inp.nextInt()
            val s = inp.next()
            if (s.compareTo(s1) == 0)
                c1--
            else
                c2--
            out.println("$c1 $c2")
        }
    }

    internal class InputReader(stream: InputStream) {
        private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
        private var tokenizer: StringTokenizer? = null

        init {
            tokenizer = null
        }

        operator fun next(): String {
            while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
                try {
                    tokenizer = StringTokenizer(reader.readLine())
                } catch (e: IOException) {
                    throw RuntimeException(e)
                }
            }
            return tokenizer!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return next().toLong()
        }
    }
}
