from collections import deque def query(s): print(''.join(s), flush = True) v = int(input()) if v == -1: exit() return v dys = (0, 1, 0, -1) dxs = (-1, 0, 1, 0) direcs = "LDRU" toid = {'L':0, 'D':1, 'R':2, 'U':3} def reconst(s, l): y, x = 0, 0 for i in range(l): dir = toid[s[i]] if dir == 0: ver[y][x] = 0 elif dir == 1: hor[y+1][x] = 0 elif dir == 2: ver[y][x+1] = 0 else: hor[y][x] = 0 dy, dx = dys[dir], dxs[dir] y, x = y+dy, x+dx dir = toid[s[l]] if dir == 0: ver[y][x] = 1 elif dir == 1: hor[y+1][x] = 1 elif dir == 2: ver[y][x+1] = 1 else: hor[y][x] = 1 h, w, p = map(int, input().split()) start = 0 goal = (h-1)*w+w-1 maxT = 1000 hor = [[-1]*w for i in range(h+1)] ver = [[-1]*(w+1) for i in range(h)] for x in range(w): hor[0][x] = 1 hor[h][x] = 1 for y in range(h): ver[y][0] = 1 ver[y][w] = 1 for iter in range(maxT//3): q = deque([]) q.append(0) prev = [-1]*(h*w) direction = [-1]*(h*w) visit = [False]*(h*w) visit[0] = True while q: v = q.popleft() y, x = divmod(v, w) for i in range(4): dy, dx = dys[i], dxs[i] ny = y + dy nx = x + dx if not (0 <= ny < h and 0 <= nx < w): continue if (dx==-1 and ver[y][x]!=1) or (dx==1 and ver[y][x+1] != 1) or (dy==-1 and hor[y][x]!=1) or (dy==1 and hor[y+1][x]!=1): nv = ny*w+nx if not visit[nv]: q.append(nv) prev[nv] = v direction[nv] = i visit[nv] = True if visit[goal]: cur = goal s = [] while cur != -1: if cur != start: dir = direction[cur] s.append(direcs[dir]) cur = prev[cur] s.reverse() v0 = query(s) v1 = query(s) v2 = query(s) reconst(s, max(v0, v1, v2)) else: s = ['D']*(h-1)+['R']*(w-1) v0 = query(s) v1 = query(s) v2 = query(s) reconst(s, max(v0, v1, v2))