#由1构成的直线是i=j (y=x) => abs(i-j)=0 => 0+1=1
#由2构成的直线是i=j+1 和 i=j-1 => abs(i-j)=1 => 1+1=2
#...
#由k 构成的直线是i=j+b和i=j-b => abs(i-j)=b => b+1=b+1=k
#
while 1:
try:
n=int(input())
if n != 0:
li=[]
for i in range(n):
st=[]
for j in range(n):
st.append(1+abs(i-j))
li.append(st)
#print(li)
for i in li:
for j in i:
print(j,end=' ')
print('')
print('')
except:
break