Scanf.scanf "%d" (fun n ->
    let dump k =
        let a = Array.make k [] in
        let rec loop_i i cur =
            let rec loop_j j cur =
                if j >= k then cur else (
                    a.(i) <- cur :: a.(i);
                    a.(j) <- cur :: a.(j);
                    loop_j (j + 1) (cur + 1)
                )
            in
            if i = k then () else
                loop_i (i + 1) (loop_j (i + 1) cur)
        in
        loop_i 0 1;
        Array.iter (fun l ->
            let b = Array.of_list l in
            Printf.printf "%d" (Array.length b);
            Array.iter (Printf.printf " %d") b;
            print_newline ()) a
    in

    let rec loop k =
        let k2 = k * (k + 1) / 2 in
        if k2 = n then k2 else
            if k2 < n then loop (k + 1) else (-1)
    in
    let k = loop 2 in
    if k < 0 then print_endline "No" else (
        Printf.printf "Yes\n%d\n" k;
        dump k
    )
)