func_code_string: #include <bits/stdc++.h>   using namespace std;   int b[1111][1111], n, m, k, q1, q2, xs, ys, step = 0, x, y, c;   vector<char> v;   char a[1111][1111];   queue<pair<int, int> > q;   void add(int x, int y, int c) {     if (x < 0 || y < 0 || x >= n || y >= m || a[x][y] ==  *  || b[x][y] <= c)       return;     b[x][y] = c;     q.push(make_pair(x, y));   }   bool check(int x, int y) {     if (step + b[x][y] > k) return false;     if (x < 0 || y < 0 || x >= n || y >= m || a[x][y] ==  * ) return false;     return true;   }   int main() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         cin >> a[i][j];         if (a[i][j] ==  X ) {           xs = i;           ys = j;         }       }     for (int i = 0; i <= n; i++)       for (int j = 0; j <= m; j++) b[i][j] = 1e9;     b[xs][ys] = 0;     q.push(make_pair(xs, ys));     while (!q.empty()) {       x = q.front().first;       y = q.front().second;       q.pop();       c = b[x][y] + 1;       add(x + 1, y, c);       add(x - 1, y, c);       add(x, y + 1, c);       add(x, y - 1, c);     }     int x = xs;     int y = ys;     while (81 == 81) {       if (v.size() == k && x == xs && y == ys) break;       step = v.size();       if (check(x + 1, y)) {         v.push_back( D );         x++;         continue;       }       if (check(x, y - 1)) {         v.push_back( L );         y--;         continue;       }       if (check(x, y + 1)) {         v.push_back( R );         y++;         continue;       }       if (check(x - 1, y)) {         v.push_back( U );         x--;         continue;       }       cout <<  IMPOSSIBLE ;       return 0;     }     for (int i = 0; i < v.size(); i++) cout << v[i];     return 0;   }   