def searching_path(m, path, exit_path, i, j):
    (r, c) = (len(m), len(m[0]))
    (exit_row, exit_col) = exit_path
    if ((i == exit_row) and (j == exit_col)):
        print((''.join((e for e in path[1:])) + m[i][j]))
        m[exit_row][exit_col] = '-'
        return
    path.append(m[i][j])
    if ((0 <= (i + 1) <= (r - 1)) and (0 <= j <= (c - 1)) and (m[(i + 1)][j] == '-')):
        m[(i + 1)][j] = 'D'
        searching_path(m, path, exit_path, (i + 1), j)
    if ((0 <= i <= (r - 1)) and (0 <= (j + 1) <= (c - 1)) and (m[i][(j + 1)] == '-')):
        m[i][(j + 1)] = 'R'
        searching_path(m, path, exit_path, i, (j + 1))
    if ((0 <= i <= (r - 1)) and (0 <= (j - 1) <= (c - 1)) and (m[i][(j - 1)] == '-')):
        m[i][(j - 1)] = 'L'
        searching_path(m, path, exit_path, i, (j - 1))
    if ((0 <= (i - 1) <= (r - 1)) and (0 <= j <= (c - 1)) and (m[(i - 1)][j] == '-')):
        m[(i - 1)][j] = 'U'
        searching_path(m, path, exit_path, (i - 1), j)
    path.pop()
def searching_path(m, path, exit_path, i, j):
    (r, c) = (len(m), len(m[0]))
    (exit_row, exit_col) = exit_path
    if ((i == exit_row) and (j == exit_col)):
        print((.join((e for e in path[1:])) + m[i][j]))
        m[exit_row][exit_col] = '-'
        return
    path.append(m[i][j])
    if ((0 <= (i + 1) <= (r - 1)) and (0 <= j <= (c - 1)) and (m[(i + 1)][j] == '-')):
        m[(i + 1)][j] = 'D'
        searching_path(m, path, exit_path, (i + 1), j)
    if ((0 <= i <= (r - 1)) and (0 <= (j + 1) <= (c - 1)) and (m[i][(j + 1)] == '-')):
        m[i][(j + 1)] = 'R'
        searching_path(m, path, exit_path, i, (j + 1))
    if ((0 <= i <= (r - 1)) and (0 <= (j - 1) <= (c - 1)) and (m[i][(j - 1)] == '-')):
        m[i][(j - 1)] = 'L'
        searching_path(m, path, exit_path, i, (j - 1))
    if ((0 <= (i - 1) <= (r - 1)) and (0 <= j <= (c - 1)) and (m[(i - 1)][j] == '-')):
        m[(i - 1)][j] = 'U'
        searching_path(m, path, exit_path, (i - 1), j)
    path.pop()