fun main(args: Array<String>) {
    var (s,t) = readLine()!!.split(" ")
    var (a,b) = readLine()!!.split(" ").map { it.toInt() }
    var u = readLine()!!
    if(s.equals(u))a -=1
    if(t.equals(u))b -=1
    println(a.toString()+" "+b.toString())
}