#include <bits/stdc++.h>   using namespace std;   const int inf = 1.01e9;   const double eps = 1e-9;   const int N = 1010;   char s[N][N];   char res[N * N];   int resc = 0;   char ch[4] = { D ,  L ,  R ,  U };   int dx[4] = {1, 0, 0, -1};   int dy[4] = {0, -1, 1, 0};   pair<int, int> q[N * N];   int st = 0, en = 0;   int d[N][N];   int n, m;   void bfs(int x, int y) {     for (int i = 0; (i) < (n); ++i)       for (int j = 0; (j) < (m); ++j) d[i][j] = inf;     d[x][y] = 0;     q[en++] = {x, y};     while (st < en) {       x = q[st].first;       y = q[st].second;       st++;       for (int i = 0; (i) < (4); ++i) {         int xx = x + dx[i];         int yy = y + dy[i];         if (0 <= xx && xx < n && 0 <= yy && yy < m && s[xx][yy] ==  .  &&             d[xx][yy] == inf) {           d[xx][yy] = d[x][y] + 1;           q[en++] = {xx, yy};         }       }     }   }   int main() {     int k;     scanf( %d%d%d , &n, &m, &k);     if (k & 1) {       printf( IMPOSSIBLE n );       return 0;     }     for (int i = 0; (i) < (n); ++i) scanf( %s , s[i]);     int px = -1, py = -1;     for (int i = 0; (i) < (n); ++i)       for (int j = 0; (j) < (m); ++j)         if (s[i][j] ==  X ) {           px = i;           py = j;           s[i][j] =  . ;         }     bfs(px, py);     int x = px, y = py;     for (int it = 0; (it) < (k); ++it) {       int ok = 0;       for (int i = 0; (i) < (4); ++i) {         int xx = x + dx[i];         int yy = y + dy[i];         if (0 <= xx && xx < n && 0 <= yy && yy < m && d[xx][yy] <= k - it - 1) {           res[resc++] = ch[i];           x = xx;           y = yy;           ok = 1;           break;         }       }       if (!ok) {         printf( IMPOSSIBLE n );         return 0;       }     }     printf( %s n , res);     return 0;   }   