exception Exodus

let rec solve candidates =
  List.map (fun (i, j, b, b') ->
    let k = (i + j) / 2 in
    Printf.printf "%d\n" k;
    begin match read_line () with
    | "Male" -> true
    | "Female" -> false
    | "Vacant" -> raise Exodus
    end
    |> (fun b'' -> [(i, k, b, b''); (j, k, b'', b')])) candidates
  |> List.concat
  |> (fun candidates ->
      if List.for_all (fun (i, j, b, b') -> (j - i) mod 2 = 0 = (b = b')) candidates then candidates
      else List.filter (fun (i, j, b, b') -> (j - i) mod 2 = 0 <> (b = b')) candidates)
  |> solve

let () =
  let n = int_of_string @@ read_line () in
  print_endline "0";
  try
    begin match read_line () with
    | "Male" -> true
    | "Female" -> false
    | "Vacant" -> raise Exodus
    end
    |> (fun b -> solve [(0, n, b, b)])
  with Exodus -> ()