#include #ifdef LOCAL #include #else #define debug(...) void(0) #endif using namespace std; typedef long long ll; #define all(x) begin(x), end(x) constexpr int INF = (1 << 30) - 1; constexpr long long IINF = (1LL << 60) - 1; constexpr int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; template istream& operator>>(istream& is, vector& v) { for (auto& x : v) is >> x; return is; } template ostream& operator<<(ostream& os, const vector& v) { auto sep = ""; for (const auto& x : v) os << exchange(sep, " ") << x; return os; } template bool chmin(T& x, U&& y) { return y < x and (x = forward(y), true); } template bool chmax(T& x, U&& y) { return x < y and (x = forward(y), true); } template void mkuni(vector& v) { sort(begin(v), end(v)); v.erase(unique(begin(v), end(v)), end(v)); } template int lwb(const vector& v, const T& x) { return lower_bound(begin(v), end(v), x) - begin(v); } const string dir = "DRUL"; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int H, W, K, L, R; cin >> H >> W >> K >> L >> R; vector S(H); cin >> S; L--; if ((R - L) & 1) { cout << "No\n"; return 0; } auto calc = [&](int sx, int sy) -> pair>, vector>> { vector res(H, vector(W, INF)), pre(H, vector(W, -1)); queue> que; res[sx][sy] = 0; que.emplace(sx, sy); while (not que.empty()) { auto [x, y] = que.front(); que.pop(); for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; if (nx < 0 or H <= nx or ny < 0 or W <= ny) continue; if (S[nx][ny] == '#') continue; if (res[nx][ny] != INF) continue; res[nx][ny] = res[x][y] + 1; pre[nx][ny] = i; que.emplace(nx, ny); } } return {res, pre}; }; auto [A, preA] = calc(0, 0); auto [B, preB] = calc(H - 1, W - 1); int f = L, g = K - R; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (A[i][j] > f or B[i][j] > g) continue; if ((f - A[i][j]) & 1) continue; if ((g - B[i][j]) & 1) continue; int ok = 0; if (i - 1 >= 0 and i + 1 < H and S[i - 1][j] == '.' and S[i + 1][j] == '.') ok |= 1; if (j - 1 >= 0 and j + 1 < W and S[i][j - 1] == '.' and S[i][j + 1] == '.') ok |= 2; if (ok == 0) continue; string ans = ""; for (int x = i, y = j; preA[x][y] != -1;) { int d = preA[x][y]; ans += dir[d]; x -= dx[d], y -= dy[d]; } reverse(all(ans)); for (int i = 0; i < (R - L) / 2; i++) ans += (ok & 1 ? "DU" : "LR"); for (int x = i, y = j; preB[x][y] != -1;) { int d = preB[x][y] ^ 2; ans += dir[d]; x += dx[d], y += dy[d]; } cout << "Yes\n"; cout << ans << '\n'; return 0; } } cout << "No\n"; return 0; }