11147 - I2P(I)2016_Yang_mid1_practice4   

Description

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. (0 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 ' '.

Sample Input  Download

Sample Output  Download

Tags




Discuss