eolymp
bolt
Try our new interface for solving problems
Problems

Determinant of the matrix

Determinant of the matrix

Find the matrix of size n × n such that its determinant equals to a given number k. The elements of the matrix must be integers from 0 to k - 1.

Input

Contains two integers n and k (1n100, 1k106) - the dimension of the matrix and the value of the determinant.

Output

If the required matrix does not exist, print Impossible. Otherwise print n lines of n integers each. Numbers must be within [0, k - 1]. In this case, the determinant of the printed matrix must be equal to k.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 5
Output example #1
3 1 1
1 2 2
3 1 2
Author A. Milanin
Source ACM, Ukraine, First Stage, 09.04.2011