#include using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 }; const long long mod = 998244353; const ll inf = 1LL << 60; const int INF = 5e8; int main() { int h, w, k, l, r; cin >> h >> w >> k >> l >> r; vector s(h); for (int i = 0; i < h; i++) cin >> s[i]; if ((h + w) % 2 != k % 2 or (l - r + 1) % 2 or h - 1 + w - 1 > k) { cout << "No" << endl; return 0; } vector> ok(h, vector(w)); for (int i = 1; i < h - 1; i++) { for (int j = 1; j < w - 1; j++) { if (s[i][j] == '#') continue; if (s[i + 1][j] == '.' and s[i - 1][j] == '.') ok[i][j] = true; if (s[i][j + 1] == '.' and s[i][j - 1] == '.') ok[i][j] = true; } } vector> sd(h, vector(w, -1)), gd(h, vector(w, -1)); vector>> ps(h, vector>(w)), pd(h, vector>(w)); queue> q; auto bfs = [&](int sx, int sy, vector>& dist, vector>>& pre) -> void { q.emplace(sx, sy); dist[sx][sy] = 0; while (q.size()) { auto [x, y] = q.front(); q.pop(); for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; if (nx < 0 or ny < 0 or nx >= h or ny >= w or s[nx][ny] == '#') continue; if (dist[nx][ny] != -1) continue; dist[nx][ny] = dist[x][y] + 1; pre[nx][ny] = { x, y }; q.emplace(nx, ny); } } }; bfs(0, 0, sd, ps); bfs(h - 1, w - 1, gd, pd); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (sd[i][j] == -1 or gd[i][j] == -1 or sd[i][j] + gd[i][j] >= k) continue; if (ok[i][j] and sd[i][j] <= l - 1 and (l - 1) % 2 == sd[i][j] % 2) { string t = ""; int x = i, y = j; while (x != 0 or y != 0) { auto [px, py] = ps[x][y]; if (x == px) { if (py + 1 == y) t.push_back('R'); else t.push_back('L'); } else { if (px + 1 == x) t.push_back('D'); else t.push_back('U'); } x = px; y = py; } reverse(t.begin(), t.end()); if (s[i + 1][j] == '.' and s[i - 1][j] == '.') { while ((int)t.size() < k - gd[i][j]) { t.push_back('U'); t.push_back('D'); } } else { while ((int)t.size() < k - gd[i][j]) { t.push_back('R'); t.push_back('L'); } } x = i; y = j; while (x != h - 1 or y != w - 1) { auto [px, py] = pd[x][y]; if (x == px) { if (y + 1 == py) t.push_back('R'); else t.push_back('L'); } else { if (x + 1 == px) t.push_back('D'); else t.push_back('U'); } x = px; y = py; } if ((int)t.size() != k) continue; cout << "Yes" << endl; cout << t << endl; return 0; } } } cout << "No" << endl; }