import java.util.*

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)

    val sString = sc.next()
    val tString = sc.next()

    var sNum = sc.nextInt()
    var tNum = sc.nextInt()

    val uString = sc.next()

    if(sString == uString)sNum--
    if(tString == uString)tNum--

    println("$sNum $tNum")

    sc.close()
}