import sys import numpy as np readline = sys.stdin.readline read = sys.stdin.read v, d = map(int, readline().split()) if d == 1: ans = np.ones((v,v), dtype=np.int64) else: ans = np.zeros((v,v), dtype=np.int64) ans[0] = 1 ans[:,0] = 1 for l in ans: print(''.join(map(str, l)))