#include <bits/stdc++.h>
using namespace std;
const int mod = int(1e9) + 7;
string z = "DLRU";
int dx[] = {1, 0, 0, -1};
int dy[] = {0, -1, 1, 0};
int a[1024][1024];
int d[1024][1024];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  int x, y;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; j++) {
      if (s[j - 1] == 'X') {
        s[j - 1] = '.';
        x = i;
        y = j;
      }
      if (s[j - 1] == '.') a[i][j] = 1;
      d[i][j] = mod;
    }
  }
  d[x][y] = 0;
  list<pair<int, int>> sp;
  sp.push_back({x, y});
  while (sp.begin() != sp.end()) {
    int x0 = sp.front().first;
    int y0 = sp.front().second;
    sp.pop_front();
    for (int i = 0; i < 4; i++) {
      int xx = x0 + dx[i];
      int yy = y0 + dy[i];
      if (d[xx][yy] == mod && a[xx][yy] == 1) {
        d[xx][yy] = d[x0][y0] + 1;
        sp.push_back({xx, yy});
      }
    }
  }
  string ans = "";
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < 4; j++) {
      int xx = x + dx[j];
      int yy = y + dy[j];
      if (d[xx][yy] + i + 1 <= k && a[xx][yy] == 1) {
        ans += z[j];
        x = xx;
        y = yy;
        break;
      }
    }
  }
  if (ans.size() < k) ans = "IMPOSSIBLE";
  cout << ans << endl;
  return 0;
}
