fun main(args: Array<String>) {
    val (s1, s2) = readLine()!!.split(" ")
    var (A, B) = readLine()!!.split(" ").map { it.toLong() }
    val s3 = readLine()!!
    when {
        s1 == s3 -> A--
        s2 == s3 -> B--
    }
    println("$A $B")
}