import sys readline=sys.stdin.readline write=sys.stdout.write from math import gcd as GCD import math N,M=map(int,readline().split()) ans_lst=[[1]*(N+1) for i in range(N+1)] x,y=N,0 ans_lst[x][y]=0 for s in readline().rstrip(): if s=="R": y+=1 elif s=="L": y-=1 elif s=="U": x-=1 else: x+=1 ans_lst[x][y]=0 for ans in ans_lst: print(*ans)