#include <bits/stdc++.h>
using namespace std;
int y[] = {0, -1, 1, 0};
int x[] = {1, 0, 0, -1};
char dir[] = {'D', 'L', 'R', 'U'};
vector<char> path;
int n, m, k;
char table[1010][1010];
map<char, char> rev{{'R', 'L'}, {'L', 'R'}, {'U', 'D'}, {'D', 'U'}};
int mark[1010][1010];
void recersive(int a, int b) {
  for (int i = 0; i < 4 && path.size() < k; i++) {
    int xx = a + x[i];
    int yy = b + y[i];
    if (xx < 1 || xx > n || yy < 1 || yy > m || table[xx][yy] != '.') continue;
    if (mark[xx][yy] > k - path.size() - 1) continue;
    path.push_back(dir[i]);
    recersive(xx, yy);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  int xx, yy;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> table[i][j];
      if (table[i][j] == 'X') {
        xx = i;
        yy = j;
      }
      mark[i][j] = -1;
    }
  }
  table[xx][yy] = '.';
  queue<pair<int, int> > que;
  que.push({xx, yy});
  mark[xx][yy] = 0;
  while (!que.empty()) {
    pair<int, int> p = que.front();
    que.pop();
    for (int i = 0; i < 4; i++) {
      int xx = p.first + x[i], yy = p.second + y[i];
      if (mark[xx][yy] != -1 || xx < 0 || xx > n || yy < 0 || yy > m ||
          table[xx][yy] != '.')
        continue;
      mark[xx][yy] = mark[p.first][p.second] + 1;
      que.push({xx, yy});
    }
  }
  recersive(xx, yy);
  if (k & 1 || path.size() < k) return cout << "IMPOSSIBLE", 0;
  for (char i : path) cout << i;
  return 0;
}
