span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">frequentList</span><span class="p">:</span>
            <span class="n">nextList</span> <span class="o">=</span> <span class="p">[</span><span class="n">i</span> <span class="o">|</span> <span class="n">j</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">frequentList</span> <span class="k">if</span> <span 