n, m = map(int, input().split()) s = input() ans = [[1 for j in range(n + 1)] for i in range(n + 1)] ans[-1][0] = 0 now_y = n now_x = 0 for i in range(m): if s[i] == "U": now_y -= 1 elif s[i] == "R": now_x += 1 elif s[i] == "L": now_x -= 1 else: now_y += 1 ans[now_y][now_x] = 0 for i in ans: print(*i)