fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    var s = sc.next()
    var t = sc.next()
    var a = sc.nextInt()
    var b = sc.nextInt()

    var u = sc.next()

    print(a - if (s == u) 1 else 0)
    print(" ")
    print(b - if (t == u) 1 else 0)
}
