output-markov to pick the right value for p and q