n=int(input()) s=[0]*n a='' for i in range(n): s[(i*2)%n]=str(i+1) for i in range(n): a+=' '.join(s[i:]+s[:i])+'\n' print(a[:-1])