Generalized Markov chain to prefix with N elements
Added sample output