#include <bits/stdc++.h>
using namespace std;
const int mxN = 1001;
bool pass[mxN][mxN];
int dist[mxN][mxN];
bool visited[mxN][mxN];
int n, m;
bool check(int x, int y) {
  return !(x < 0 || x >= n || y < 0 || y >= m || !pass[y][x] || visited[y][x]);
}
void bfs(int x, int y) {
  queue<pair<pair<int, int>, int>> q;
  q.push({{x, y}, 0});
  dist[y][x] = 0;
  visited[y][x] = true;
  while (!q.empty()) {
    auto cur = q.front();
    q.pop();
    x = cur.first.first;
    y = cur.first.second;
    int len = cur.second;
    dist[y][x] = len;
    if (check(x - 1, y)) {
      visited[y][x - 1] = true;
      q.push({{x - 1, y}, len + 1});
    }
    if (check(x, y - 1)) {
      visited[y - 1][x] = true;
      q.push({{x, y - 1}, len + 1});
    }
    if (check(x, y + 1)) {
      visited[y + 1][x] = true;
      q.push({{x, y + 1}, len + 1});
    }
    if (check(x + 1, y)) {
      visited[y][x + 1] = true;
      q.push({{x + 1, y}, len + 1});
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      visited[j][i] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> m >> n >> k;
  int x, y;
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      char c;
      cin >> c;
      pass[j][i] = c != '*';
      if (c == 'X') {
        x = i;
        y = j;
      }
    }
  }
  bool ok = false;
  if (check(x - 1, y)) {
    ok = true;
  }
  if (check(x, y - 1)) {
    ok = true;
  }
  if (check(x, y + 1)) {
    ok = true;
  }
  if (check(x + 1, y)) {
    ok = true;
  }
  if (!ok || k % 2 == 1) {
    cout << "IMPOSSIBLE";
    return 0;
  }
  bfs(x, y);
  vector<char> ans;
  while (k--) {
    if (check(x, y + 1) && dist[y + 1][x] <= k) {
      ans.push_back('D');
      y++;
      continue;
    }
    if (check(x - 1, y) && dist[y][x - 1] <= k) {
      ans.push_back('L');
      x--;
      continue;
    }
    if (check(x + 1, y) && dist[y][x + 1] <= k) {
      ans.push_back('R');
      x++;
      continue;
    }
    if (check(x, y - 1) && dist[y - 1][x] <= k) {
      ans.push_back('U');
      y--;
      continue;
    }
    cout << "IMPOSSIBLE";
    return 0;
  }
  for (char c : ans) cout << c;
}
