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