#include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 998244353; // constexpr int MOD = 1000000007; constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1}; constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1}; constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << fixed << setprecision(20); } } iosetup; int main() { int h, w, k, l, r; cin >> h >> w >> k >> l >> r; --l; --r; if ((r - l + 1) % 2 == 1) { cout << "No\n"; return 0; } vector s(h); REP(i, h) cin >> s[i]; const auto can_visit = [&](const int sy, const int sx, const int length) -> pair>, vector>> { vector dist(h, vector(w, -1)), prv(h, vector(w, -1)); dist[sy][sx] = 0; for (queue> que({{sy, sx}}); !que.empty(); que.pop()) { const auto [i, j] = que.front(); if (dist[i][j] == length) break; REP(k, 4) { const int y = i + DY4[k], x = j + DX4[k]; if (0 <= y && y < h && 0 <= x && x < w && s[y][x] == '.' && dist[y][x] == -1) { dist[y][x] = dist[i][j] + 1; prv[y][x] = (k + 2) % 4; que.emplace(y, x); } } } REP(i, h) REP(j, w) { if (dist[i][j] != -1 && (length - dist[i][j]) % 2 == 1) dist[i][j] = -1; } return {dist, prv}; }; const auto [dist1, prv1] = can_visit(0, 0, l); const auto [dist2, prv2] = can_visit(h - 1, w - 1, k - 1 - r); REP(i, h) REP(j, w) { if (dist1[i][j] != -1 && dist2[i][j] != -1 && ((i > 0 && i + 1 < h && s[i - 1][j] == '.' && s[i + 1][j] == '.') || (j > 0 && j + 1 < w && s[i][j - 1] == '.' && s[i][j + 1] == '.'))) { string s1 = "", s2 = ""; for (int y = i, x = j; y != 0 || x != 0;) { const int k = prv1[y][x]; if (k == 0) s1 += 'U'; if (k == 1) s1 += 'R'; if (k == 2) s1 += 'D'; if (k == 3) s1 += 'L'; y += DY4[k]; x += DX4[k]; } ranges::reverse(s1); for (int y = i, x = j; y != h - 1 || x != w - 1;) { const int k = prv2[y][x]; if (k == 0) s2 += 'D'; if (k == 1) s2 += 'L'; if (k == 2) s2 += 'U'; if (k == 3) s2 += 'R'; y += DY4[k]; x += DX4[k]; } cout << "Yes\n" << s1; if (i > 0 && i + 1 < h && s[i - 1][j] == '.' && s[i + 1][j] == '.') { for (int j = l; j <= r; j += 2) { cout << "UD"; } } else { for (int j = l; j <= r; j += 2) { cout << "LR"; } } cout << s2 << '\n'; return 0; } } cout << "No\n"; return 0; }