fun main(args: Array<String>) {
    val color = readLine()!!.split(" ").map(String::toString)
    val size = readLine()!!.split(" ").map(String::toInt).toMutableList()
    val select = readLine()!!.toString()

    if (select == color[0]) size[0] = size[0] -1 else size[1] = size[1] -1
    println("${size[0]} ${size[1]}")
}