v,d = map(int,input().split()) if d==1: for _ in range(v): print("1"*v) else: print("1"*v) for _ in range(v-1): print("1"+"0"*(v-1))