N=int(input()) ANS=[] now=1 for i in range(N): x=now//2 y=now%2 X=[2]*x+[1]*y+[0]*(N-x-y) ANS.append(X) if i%2==0: now+=3 else: now+=1 for ans in ANS: print(*ans)