#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+1e4,M=1e3+1e2;
const ll Maxn=0x3ffffff,Minm=-0x3ffffff;
ll n;
signed main()
{
cin>>n;
while(n!=0)
{
for(ll i=1;i<=n;i++)
{
for(ll j=1;j<=n;j++)
{
ll ans=Maxn;
ans=min(ans,i);
ans=min(ans,n-i+1);
ans=min(ans,j);
ans=min(ans,n-j+1);
cout<<ans<<" ";
}
cout<<"\n";
}
cout<<"\n";
cin>>n;
}
}