import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (s, t) = (0 until 2).map { sc.next() }
    var (a, b) = (0 until 2).map { sc.nextInt() }
    val u = sc.next()
    if (u == s) {
        a -= 1
    } else {
        b -= 1
    }
    println("$a $b")
}