#include<iostream>
using namespace std;
int main()
{
int n;
while(cin >> n,n) //输入n,当n为0时停止输入
{
for(int i = 0;i < n;i ++)
{
for(int j = 0;j < n;j ++)
{
int up = i + 1, down = n - i, left = j + 1, right = n - j ;
cout << min(min(up, down),min(left, right)) << ' ';
}
cout << endl;
}
cout << endl;
}
return 0;
}