h,w=map(int,input().split()) s=[[1]*w for i in range(h)] def put(s): for l in s:print(*l) def cnt(s): res=0 for i in range(h): for j in range(w):res+=s[i][j] print(res) if h%2==w%2==0: cnt(s) put(s) elif h%2==0 and w%2==1: for i in range(h):s[i][0]=0 cnt(s) put(s) elif h%2==1 and w%2==0: for j in range(w):s[0][j]=0 cnt(s) put(s) else: if h