Scanf.scanf "%d" (fun n ->
    let n = n - 1 in
    let calc r digits =
        let rec loop r i acc =
            if i = 0 then acc else
                loop (r / 26) (i - 1) (Printf.sprintf "%c%s" (char_of_int ((r mod 26) + 97)) acc)
        in
        loop r digits ""
    in
    let rec loop p digits d k =
        if n < k then calc (n - p) digits else
            loop k (digits + 1) (d * 26) (k + d)
    in
    loop 0 1 (26 * 26) 26 |> print_endline
)