11168 - circulant matrix   

Description

A circulant matrix is a square matrix in which all column vectors are composed of the same elements and each column vector is rotated one element to the down relative to the preceding column vector.

Given a vector of dimension N, use it to create an N-by-N circulant matrix. An example of circulant matrix:
1 5 4 3 2
2 1 5 4 3
3 2 1 5 4
4 3 2 1 5
5 4 3 2 1

Input

The first line contains a positive integer N indicating the size of the matrix.

The second line contains N numbers indicating the components of the vector. Note that each component of the vector is a one-digit number.

Output

The N-by-N circulant matrix. Print the elements of the matrix using the format "%2d".

Each row is ended with a newline character '\n'.

Sample Input  Download

Sample Output  Download

Tags




Discuss