#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); const ll MOD1000000007 = 1000000007; const ll MOD998244353 = 998244353; const ll MOD[3] = {999727999, 1070777777, 1000000007}; const ll LINF = 1LL << 60; const int IINF = (1 << 30) - 1; template struct Edge{ int to; T w; Edge(int to_, T w_=1){ to = to_; w=w_; } }; template using Tree = vector>>; template using Graph = vector>>; /* 容量&重み付きエッジ for Dinic */ template struct REdge{ int to; T cap; T cost; int rev; REdge(int to_, T cap_, T cost_=1){ to = to_; cap = cap_; cost = cost_; } REdge(int to_, T cap_, T cost_, int rev_){ to = to_; cap = cap_; cost = cost_; rev = rev_; } }; /* 残余グラフ for Dinic */ template using RGraph = vector>>; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll H, W, K, L, R; cin >> H >> W >> K >> L >> R; vector S(H); rep(i, H) cin >> S[i]; if((H+W-2)%2 != K%2){ cout << "No" << endl; return 0; } ll di[4] = {0, 0, 1, -1}; ll dj[4] = {1, -1, 0, 0}; char ddir[4] = {'R', 'L', 'D', 'U'}; char rdir[4] = {'L', 'R', 'U', 'D'}; map alloc; alloc['R'] = 0; alloc['L'] = 1; alloc['D'] = 2; alloc['U'] = 3; queue Q; vector> sdist(H, vector(W, -1)); vector> sdir(H, vector(W, "")); sdist[0][0] = 0; Q.push({0, 0}); while(!Q.empty()){ ll now_i = Q.front().fi; ll now_j = Q.front().se; Q.pop(); rep(k, 4){ ll nxt_i = now_i + di[k]; ll nxt_j = now_j + dj[k]; if(nxt_i<0||nxt_j<0||H<=nxt_i||W<=nxt_j) continue; if(S[nxt_i][nxt_j]=='#') continue; if(sdist[nxt_i][nxt_j]!=-1) continue; sdist[nxt_i][nxt_j] = sdist[now_i][now_j]+1; sdir[nxt_i][nxt_j] = sdir[now_i][now_j]+ddir[k]; Q.push({nxt_i, nxt_j}); } } vector> tdist(H, vector(W, -1)); vector> tdir(H, vector(W, "")); tdist[H-1][W-1] = 0; Q.push({H-1, W-1}); while(!Q.empty()){ ll now_i = Q.front().fi; ll now_j = Q.front().se; Q.pop(); rep(k, 4){ ll nxt_i = now_i + di[k]; ll nxt_j = now_j + dj[k]; if(nxt_i<0||nxt_j<0||H<=nxt_i||W<=nxt_j) continue; if(S[nxt_i][nxt_j]=='#') continue; if(tdist[nxt_i][nxt_j]!=-1) continue; tdist[nxt_i][nxt_j] = tdist[now_i][now_j]+1; tdir[nxt_i][nxt_j] = rdir[k] + tdir[now_i][now_j]; Q.push({nxt_i, nxt_j}); } } //L-1回目の行動後の到達頂点 for(ll si=0; siL-1) continue; if(S[si][sj]=='#') continue; string ans = ""; //1~L-1回目までの移動 ans += sdir[si][sj]; ll x = alloc[ans.back()]; rep(k, (L-1-sdist[si][sj])/2){ ans += rdir[x]; ans += ddir[x]; } //横側を確認 if(0<=sj-1 && sj+1=K-R){ //okデス //L~R回目までの移動 rep(k, (R-L+1)/2){ ans+="LR"; } //R+1~K回目までの行動 ans+=tdir[si][sj]; x = alloc[tdir[si][sj].back()]; ll tmp = K-(ll)ans.size(); rep(k, tmp/2){ ans+=rdir[x]; ans+=ddir[x]; } cout << ans << endl; return 0; }else if((R-L+1)%2==1 && tdist[si][sj-1]>=K-R){ //okデス //L~R回目までの移動 rep(k, (R-L+1)/2){ ans+="LR"; } ans+="L"; //R+1~K回目までの行動 ans+=tdir[si][sj-1]; x = alloc[tdir[si][sj-1].back()]; ll tmp = K-(ll)ans.size(); rep(k, tmp/2){ ans+=rdir[x]; ans+=ddir[x]; } cout << "Yes" << endl; cout << ans << endl; return 0; } } } //縦側を確認 if(0<=si-1 && si+1=K-R){ //okデス //L~R回目までの移動 rep(k, (R-L+1)/2){ ans+="UD"; } //R+1~K回目までの行動 ans+=tdir[si][sj]; x = alloc[tdir[si][sj].back()]; ll tmp = K-(ll)ans.size(); rep(k, tmp/2){ ans+=rdir[x]; ans+=ddir[x]; } cout << "Yes" << endl; cout << ans << endl; return 0; }else if((R-L+1)%2==1 && tdist[si-1][sj]>=K-R){ //okデス //L~R回目までの移動 rep(k, (R-L+1)/2){ ans+="UD"; } ans+="U"; //R+1~K回目までの行動 ans+=tdir[si-1][sj]; x = alloc[tdir[si-1][sj].back()]; ll tmp = K-(ll)ans.size(); rep(k, tmp/2){ ans+=rdir[x]; ans+=ddir[x]; } cout << "Yes" << endl; cout << ans << endl; return 0; } } } } cout << "No" << endl; }