let [|S;T|] = stdin.ReadLine().Split()
let [|A;B|] =
    stdin.ReadLine().Split()
    |> Array.map int
let U = stdin.ReadLine()

match U with
| x when x = S -> printfn "%d %d" (A-1) B
| x when x = T -> printfn "%d %d" A (B-1)