n,m=gets.split.map &:to_i f=(0..n).map{[1]*(n+1)} f[x=n][y=0]=0 gets.chop.chars.map{|c|c<'L'? x+=1:c<'R'? y-=1:c<'U'? y+=1:x-=1;f[x][y]=0} f.map{|g|puts g.join' '}