Scanf.scanf "%s %s" (fun s t ->
    Scanf.scanf " %d %d" (fun a b ->
        Scanf.scanf " %s" (fun u ->
            let a, b = if s = u then (a - 1, b) else (a, b - 1) in
            Printf.printf "%d %d\n" a b
        )
    )
)