let rec rep (p : t_partition) (n : int) : int =
  match p with
  | c::cs -> if List.mem n c then List.hd c else rep cs n
  | [] -> raise Not_found