let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

type seat = Male | Female

let read_seat i =
  Printf.printf "%d\n" i;
  let str = read_line () in
  match str with
    | "Vacant" -> exit 0
    | "Male" -> Male
    | "Female" -> Female
    | _ -> failwith "input format error"

let rec loop (l, ls) (r, rs) =
  let mid = (l + r) / 2 in
  let mids = read_seat mid in
  if (mid - l + 1) mod 2 = 0 then 
    if mids = ls then loop (l, ls) (mid, mids)
    else loop (mid, mids) (r, rs)
  else
    if mids = ls then loop (mid, mids) (r, rs)
    else loop (l, ls) (mid, mids)

let () = loop (0, read_seat 0) (n - 1, read_seat (n - 1))