basic markov chain recognition