def main(): n, m = map(int, input().split()) s = input() ans = [[1] * (n + 1) for _ in range(n + 1)] ans[n][0] = 0 x, y = n, 0 for c in s: if c == "R": y += 1 elif c == "L": y -= 1 elif c == "U": x -= 1 else: x += 1 ans[x][y] = 0 for row in ans: print(*row) if __name__ == "__main__": main()