n, m = map(int, input().split()) S = input() tbl = [[1 for _ in range(n+1)] for _ in range(n+1)] x, y = 0, n tbl[n][x] = 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 t in tbl: print(*t)