#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; const int di[] = {1, 0, -1, 0}; const int dj[] = {0, 1, 0, -1}; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k, l, r; cin >> n >> m >> k >> l >> r; l--; vector s(n); rep(i, n) cin >> s[i]; constexpr int INF = 1001001001; auto idxchk = [&](int i, int j) { return 0 <= i && i < n && 0 <= j && j < m; }; auto bfs = [&](int si, int sj) { VVI dist(n, VI(m, INF)); queue

q; auto add = [&](int i, int j, int d) { if (dist[i][j] == INF) { dist[i][j] = d; q.emplace(i, j); } }; add(si, sj, 0); while(q.size()) { auto [i, j] = q.front(); q.pop(); rep(k, 4) { int ni = i + di[k], nj = j + dj[k]; if (!idxchk(ni, nj)) continue; if (s[ni][nj] == '#') continue; add(ni, nj, dist[i][j] + 1); } } return dist; }; int c0 = l, c1 = k - r; VVI d0 = bfs(0, 0), d1 = bfs(n - 1, m - 1); rep(i, n) rep(j, m) { int r0 = c0 - d0[i][j]; int r1 = c1 - d1[i][j]; if (r0 < 0 || r1 < 0 || r0 % 2 || r1 % 2 || (r - l) % 2) continue; bool ok = false; if (idxchk(i-1, j) && idxchk(i+1, j) && s[i-1][j] == '.' && s[i+1][j] == '.') ok = true; else if (idxchk(i, j-1) && idxchk(i, j+1) && s[i][j-1] == '.' && s[i][j+1] == '.') ok = true; if (ok) { cout << "Yes\n"; string ans; int x = i, y = j; while(d0[x][y]) { rep(k, 4) { int nx = x + di[k], ny = y + dj[k]; if (!idxchk(nx, ny)) continue; if (d0[nx][ny] == d0[x][y] - 1) { ans += "ULDR"[k]; x = nx, y = ny; break; } } } reverse(all(ans)); int cnt = (r0 + r1 + (r - l)) / 2; if (idxchk(i-1, j) && idxchk(i+1, j) && s[i-1][j] == '.' && s[i+1][j] == '.') { rrep(_, cnt) ans += 'U', ans += 'D'; } else { rrep(_, cnt) ans += 'L', ans += 'R'; } x = i, y = j; while(d1[x][y]) { rep(k, 4) { int nx = x + di[k], ny = y + dj[k]; if (!idxchk(nx, ny)) continue; if (d1[nx][ny] == d1[x][y] - 1) { ans += "DRUL"[k]; x = nx, y = ny; break; } } } cout << ans << '\n'; return 0; } } cout << "No\n"; }