V, D = map(int, input().split()) for i in range(V): row = ['1' if i != j else '0' for j in range(V)] print(''.join(row))