fun main(args: Array<String>) {
    val (S,T) = readLine()!!.split(" ")
    val (N,M) = readLine()!!.split(" ").map(String::toInt)
    val D = readLine()!!
    println(
        if(S==D){
            ""+(N-1)+" $M"
        }else{
            "$N "+(M-1)
        }
    )
}