import sys input = sys.stdin.readline V,D=map(int,input().split()) E=[[0]*V for i in range(V)] for i in range(V): for j in range(V): if j-1<=i<=j+1 and i!=j: E[i][j]=1 E[0][0]=1 for ans in E: print("".join(map(str,ans)))