Markov chain storage and retrieval