Latin Square backtracking printing ALL combinations
<p>I have problem figuring out how to print all <a href="http://en.wikipedia.org/wiki/Latin_square" rel="nofollow">Latin Squares</a> using backtracking algorithm. I probably could use some for loops to print one of the the combinations like if matrix is 3x3
then:</p>

<p>if 1 on the upper left corner, so using loop </p>

<pre><code>1 2 3
2 3 1
3 1 2 
</code></pre>

<p>but the problem is how to print all of the permutations like</p>

<pre><code>1 2 3
3 1 2
2 3 1 
</code></pre>

<p>etc.</p>

<p>any suggestions?</p>
