#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " : " << a << endl;
  err(++it, args...);
}
const int N = 1e3 + 30;
pair<int, int> arr[N][N];
bool ya[N][N];
char wyn[N][N];
map<char, char> op;
map<int, char> ot;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int n, need_y, need_x;
void dfs(int y, int x) {
  if (ya[y][x]) return;
  ya[y][x] = true;
  for (long long i = 0; i < (4); ++i) {
    int ny = y + dy[i], nx = x + dx[i];
    if (ny < 0 or ny > n or nx < 0 or nx > n) continue;
    if (arr[ny][nx] == make_pair(need_y, need_x)) {
      if (ya[ny][nx]) continue;
      wyn[ny][nx] = op[ot[i]];
      dfs(ny, nx);
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  ;
  op['L'] = 'R', op['R'] = 'L', op['D'] = 'U', op['U'] = 'D';
  ot[0] = 'U', ot[1] = 'R', ot[2] = 'D', ot[3] = 'L';
  bool valid = true;
  cin >> n;
  vector<pair<int, int> > X;
  for (long long i = 1; i < (n + 1); ++i) {
    for (long long j = 1; j < (n + 1); ++j) {
      int y, x;
      cin >> y >> x;
      arr[i][j] = make_pair(y, x);
      if (make_pair(int(i), int(j)) == make_pair(y, x))
        X.push_back(make_pair(i, j));
    }
  }
  for (auto x : X) {
    wyn[x.first][x.second] = 'X';
    need_y = x.first, need_x = x.second;
    dfs(x.first, x.second);
  }
  for (long long i = 1; i < (n + 1); ++i)
    for (long long j = 1; j < (n + 1); ++j) {
      if (ya[i][j]) continue;
      if (arr[i][j] == make_pair(-1, -1)) {
        bool chi = false;
        for (long long k = 0; k < (4); ++k) {
          if (arr[i + dy[k]][j + dx[k]] == make_pair(-1, -1)) {
            wyn[i][j] = ot[k];
            wyn[i + dy[k]][j + dx[k]] = op[wyn[i][j]];
            ya[i][j] = true, ya[i + dy[k]][j + dx[k]] = true;
            chi = true;
            break;
          }
        }
        if (!chi) valid = false;
      }
    }
  for (long long i = 1; i < (n + 1); ++i)
    for (long long j = 1; j < (n + 1); ++j)
      if (!ya[i][j]) valid = false;
  if (!valid)
    cout << "INVALID" << endl;
  else {
    cout << "VALID" << endl;
    for (long long i = 1; i < (n + 1); ++i) {
      for (long long j = 1; j < (n + 1); ++j) cout << wyn[i][j];
      cout << endl;
    }
  }
  return 0;
}
