Describe a radix-sort method for lexicographically sorting a sequence $S$ of triplets $(k, l, m)$, where $k, l$, and $m$ are integers in the range $[0, N - 1]$, for some $N \geq 2$. How could this scheme be extended to sequences of $d$-tuples $(k_1, k_2, \ldots, k_d)$, where each $k_i$ is an integer in the range $[0, N - 1]$?