import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val s = scanner.next()
    val t = scanner.next()
    var a = scanner.nextInt()
    var b = scanner.nextInt()
    val u = scanner.next()
    if (u == s) a -= 1 else b -= 1

    println("$a $b")
}