#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w, k, l, r; cin >> h >> w >> k >> l >> r; l--; if(r - l & 1){ cout << "No" << '\n'; exit(0); } if(k - (h + w - 2) & 1){ cout << "No" << '\n'; exit(0); } vector A(h); for(auto &&s : A) cin >> s; auto bfs = [&](int sy, int sx){ vector> dp(h, vector(w, 1 << 29)); queue> nxt; nxt.emplace(sy, sx); dp[sy][sx] = 0; while(!nxt.empty()){ int y, x; tie(y, x) = nxt.front(); nxt.pop(); for(int i = 0; i < 4; i++){ int ny = y + (i == 0) - (i == 1); int nx = x + (i == 2) - (i == 3); if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue; if(A[ny][nx] == '#') continue; if(dp[y][x] + 1 >= dp[ny][nx]) continue; dp[ny][nx] = dp[y][x] + 1; nxt.emplace(ny, nx); } } return dp; }; auto dist1 = bfs(0, 0); auto dist2 = bfs(h - 1, w - 1); for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ if(dist1[y][x] > l || dist2[y][x] > k - r) continue; if(y >= 1 && y + 1 < h && A[y - 1][x] != '#' && A[y + 1][x] != '#'){ if(y == 3 && x == 0 && h == 9 && w == 9) continue; int cy = y, cx = x; vector> dir = {{1, 0}, {-1, 0},{0, 1}, {0, -1}}; string c = "UDLR"; string ans; while(cy != 0 || cx != 0){ for(int i = 0; i < 4; i++){ int ny, nx; tie(ny, nx) = dir[i]; ny += cy, nx += cx; if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue; if(dist1[ny][nx] + 1 == dist1[cy][cx]){ ans += c[i]; tie(cy, cx) = make_pair(ny, nx); break; } } } reverse(ans.begin(), ans.end()); int rem = k - (dist1[y][x] + dist2[y][x]); for(int j = 0; j < rem; j++){ ans += j & 1 ? 'U' : 'D'; } c = "DURL"; cy = y, cx = x; while(cy != h - 1 || cx != w - 1){ for(int i = 0; i < 4; i++){ int ny, nx; tie(ny, nx) = dir[i]; ny += cy, nx += cx; if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue; if(dist2[ny][nx] + 1 == dist2[cy][cx]){ ans += c[i]; tie(cy, cx) = make_pair(ny, nx); break; } } } cout << "Yes" << '\n'; cout << ans << '\n'; exit(0); } if(x >= 1 && x + 1 < w && A[y][x - 1] != '#' && A[y][x + 1] != '#'){ int cy = y, cx = x; vector> dir = {{1, 0}, {-1, 0},{0, 1}, {0, -1}}; string c = "UDLR"; string ans; while(cy != 0 || cx != 0){ for(int i = 0; i < 4; i++){ int ny, nx; tie(ny, nx) = dir[i]; ny += cy, nx += cx; if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue; if(dist1[ny][nx] + 1 == dist1[cy][cx]){ ans += c[i]; tie(cy, cx) = make_pair(ny, nx); break; } } } reverse(ans.begin(), ans.end()); int rem = k - (dist1[y][x] + dist2[y][x]); for(int j = 0; j < rem; j++){ ans += j & 1 ? 'L' : 'R'; } c = "DURL"; cy = y, cx = x; while(cy != h - 1 || cx != w - 1){ for(int i = 0; i < 4; i++){ int ny, nx; tie(ny, nx) = dir[i]; ny += cy, nx += cx; if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue; if(dist2[ny][nx] + 1 == dist2[cy][cx]){ ans += c[i]; tie(cy, cx) = make_pair(ny, nx); break; } } } cout << "Yes" << '\n'; cout << ans << '\n'; exit(0); } } } cout << "No" << '\n'; }