n,m=map(int,input().split()) a=[['1']*(n+1) for _ in range(n+1)] a[n][0]='0' y,x=n,0 for i in input(): if i=='U': y-=1 elif i=='D': y+=1 elif i=='R': x+=1 else: x-=1 if 0<=y and y<=n and 0<=x and x<=n: a[y][x]='0' for i in a: print(' '.join(i))