#include <iostream>
using namespace std;
const int TEN = 10;
void generateMatrix(int matrix[][TEN], int n, int x) {
int firstColumn = 0, lastColumn = n - 1;
int firstRow = 0, lastRow = n - 1;
while (firstRow < lastRow) {
for (int i = firstColumn; i <= lastColumn; ++i) {
++x;
matrix[firstColumn][i] = x * x;
}
for (int i = firstRow + 1; i <= lastRow; ++i) {
++x;
matrix[lastColumn][i] = x * x;
}
for (int i = lastColumn - 1; i >= firstColumn && firstRow != lastRow; --i) {
++x;
matrix[lastRow][i] = x * x;
}
for (int i = lastRow - 1; i > firstRow && firstColumn != lastColumn; --i) {
++x;
matrix[lastRow][i] = x * x;
}
++firstRow;
++firstColumn;
--lastRow;
--lastColumn;
}
}
int main() {
int n, x, matrix[TEN][TEN];
cin >> n >> x;
generateMatrix(matrix, n, x);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout << matrix[i][j] << ' ';
}
cout << '\n';
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IFRFTiA9IDEwOwoKdm9pZCBnZW5lcmF0ZU1hdHJpeChpbnQgbWF0cml4W11bVEVOXSwgaW50IG4sIGludCB4KSB7CglpbnQgZmlyc3RDb2x1bW4gPSAwLCBsYXN0Q29sdW1uID0gbiAtIDE7CiAgICBpbnQgZmlyc3RSb3cgPSAwLCBsYXN0Um93ID0gbiAtIDE7CiAgICB3aGlsZSAoZmlyc3RSb3cgPCBsYXN0Um93KSB7CiAgICAgICAgZm9yIChpbnQgaSA9IGZpcnN0Q29sdW1uOyBpIDw9IGxhc3RDb2x1bW47ICsraSkgewogICAgICAgICAgICArK3g7CiAgICAgICAgICAgIG1hdHJpeFtmaXJzdENvbHVtbl1baV0gPSB4ICogeDsKICAgICAgICB9CiAgICAgICAgZm9yIChpbnQgaSA9IGZpcnN0Um93ICsgMTsgaSA8PSBsYXN0Um93OyArK2kpIHsKICAgICAgICAgICAgKyt4OwogICAgICAgICAgICBtYXRyaXhbbGFzdENvbHVtbl1baV0gPSB4ICogeDsKICAgICAgICB9CiAgICAgICAgZm9yIChpbnQgaSA9IGxhc3RDb2x1bW4gLSAxOyBpID49IGZpcnN0Q29sdW1uICYmIGZpcnN0Um93ICE9IGxhc3RSb3c7IC0taSkgewogICAgICAgICAgICArK3g7CiAgICAgICAgICAgIG1hdHJpeFtsYXN0Um93XVtpXSA9IHggKiB4OwogICAgICAgIH0KICAgICAgICBmb3IgKGludCBpID0gbGFzdFJvdyAtIDE7IGkgPiBmaXJzdFJvdyAmJiBmaXJzdENvbHVtbiAhPSBsYXN0Q29sdW1uOyAtLWkpIHsKICAgICAgICAgICAgKyt4OwogICAgICAgICAgICBtYXRyaXhbbGFzdFJvd11baV0gPSB4ICogeDsKICAgICAgICB9CiAgICAgICAgKytmaXJzdFJvdzsKICAgICAgICArK2ZpcnN0Q29sdW1uOwogICAgICAgIC0tbGFzdFJvdzsKICAgICAgICAtLWxhc3RDb2x1bW47CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgaW50IG4sIHgsIG1hdHJpeFtURU5dW1RFTl07CiAgICBjaW4gPj4gbiA+PiB4OwogICAgZ2VuZXJhdGVNYXRyaXgobWF0cml4LCBuLCB4KTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyArK2opIHsKICAgICAgICAgICAgY291dCA8PCBtYXRyaXhbaV1bal0gPDwgJyAnOwogICAgICAgIH0KICAgICAgICBjb3V0IDw8ICdcbic7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==