n, m = map(int, input().split()) S = input() tbl = [[1 for _ in range(n+1)] for _ in range(n+1)] tbl[0][0] = 0 x, y = 0, 0 for s in S: if s == "R": x += 1 elif s == "L": x -= 1 elif s == "U": y -= 1 elif s == "D": y += 1 if 0 <= y and y <= n and 0 <= x and x <= n: tbl[y][x] = 0 for i in range(n, -1, -1): print(*tbl[i])