class KimWipes: def __init__(self, N): self.sq = [[1 for i in range(N+1)] for i in range(N+1)] self_now = (0, 0) def set(self, x, y): self.x = x self.y = y self.eat() def eat(self): self.sq[self.y][self.x] = 0 def move(self, d): if d == "U": self.y = self.y + 1 elif d == "D": self.y = self.y - 1 elif d == "R": self.x = self.x + 1 elif d == "L": self.x = self.x - 1 self.eat() def dump(self): for j in self.sq[::-1]: print(" ".join(map(str,j))) N, M = map(int, input().split()) S=input() taro=KimWipes(N) taro.set(0,0) for s in list(S): taro.move(s) taro.dump()