How can the nested loops of unknown layers be implemented by recursion? : <p>int m =10;</p>

<pre><code>    int n = 9;

    int p = 4;

    int q = 7;

    for(int i=0;i&lt;m;i++){

        int a = i;

        for(int j=0;j&lt;n;j++){

            int b = j;

            if(b==a){

                continue;

            }

            for(int k=0;k&lt;p;k++){

                int c = k;

                if(c==b || c==a){

                    continue;

                }

                for(int l=0;l&lt;q;l++){

                    int d = l;

                    if(d==c || d==b || d==a){

                        continue;

                    }

                    System.out.println("i="+i+",j="+j+",k="+k+",l="+l);

                }

            }

        }

    }
</code></pre>

<p>For example, the code fragment is a four layer nested loop, and the loop between has data dependencies, and nested layers is uncertain, how it will achieve through the recursive (nested is uncertain)?</p>
