func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let st = readLine()!.split(separator: " ")
    let s = st[0]
    // let t = st[1]
    
    let ab = readInts()
    let a = ab[0]
    let b = ab[1]
    
    let u = readLine()!
    
    if u == s {
        print(a - 1, b)
    } else {
        print(a, b - 1)
    }
}

main()
