A Markov pattern with variable context depth