import sys, math sys.set_int_max_str_digits(0) N, M = map(int, input().split()) S = input() x, y = N, 0 G = [[1] * (N + 1) for _ in range(N + 1)] G[N][0] = 0 ''' y ^ | | ------> x ''' for s in S: if s == 'U': x -= 1 elif s == 'D': x += 1 elif s == 'L': y -= 1 else: y += 1 # 移動、食べる G[x][y] = 0 for g in G: print(*g)