import Foundation

let input_line = readLine()!

var split = input_line.componentsSeparatedByString(" ")
let S = split[0]
let T = split[1]
 
//標準入力二行
let input_line2 = readLine()!
split = input_line2.componentsSeparatedByString(" ")
var A = Int(split[0])!
var B = Int(split[1])!

//標準入力二行
let U = readLine()!
 
if U == S {
  A -= 1
} else {
  B -= 1
}
print(A, B)