Write a program that prints all the latin squares n × n with the first row in increasing order. A latin square must contain all the nummbers between 0 and n − 1 in each row and column.
Input
Input consists of a natural number 1 ≤ n ≤ 5.
Output
Your program must print all the latin squares n × n with the first row in increasing order. It must print a line in white after each combination.
You can print the solutions to this exercise in any order.
Input
3
Output
012 120 201 012 201 120