V, D = map(int, input().split()) for i in range(V): t = [1] * V t[i] = 0 print(*t)