fun main (args : Array<String>) {
    val (s, t) = readLine()!!.split(" ")
    val (a, b) = readLine()!!.split(" ")
    val u= readLine()!!

    var A : Int = a.toInt()
    var B : Int = b.toInt()

    if (u.toString() == s.toString()) {
        A--
    } else if (u.toString() == t.toString()) {
        B--
    }

    println("${A} ${B}")

}