Building order-n markov chains.