Latin square P18900


Statement
 

pdf   zip

html

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.

Information about the checker

You can print the solutions to this exercise in any order.

Public test cases
  • Input

    3
    

    Output

    012
    120
    201
    
    012
    201
    120
    
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++