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 i!=j: E[i][j]=1 for ans in E: print("".join(map(str,ans)))