Now outputs the Markov chain. Need to test with large inputs, and make it stop rather than output forever.