open Printf

let scan fmt f =
  Scanf.sscanf (read_line ()) fmt f

let id a = a

let (s, t) = scan "%s %s" @@ fun s t -> (s,t)
let (a, b) = scan "%d %d" @@ fun a b -> (a,b)
let u = scan "%s" id

let () =
  if u = s then
    printf "%d %d\n" (a - 1) b
  else
    printf "%d %d\n" a (b -1)
