#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
template <class T>
void print(T& x) {
  cout << x;
}
template <class T, class U>
void print(pair<T, U>& p) {
  cout << "(";
  print(p.first);
  cout << ", ";
  print(p.second);
  cout << ")";
}
template <class T>
void print(vector<T>& v) {
  cout << "{";
  if (((int)(v).size())) print(v[0]);
  for (int i = 1; i < ((int)(v).size()); i++) cout << ", ", print(v[i]);
  cout << "}\n";
}
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const char op[] = {'L', 'R', 'U', 'D'};
const char opf[] = {'R', 'L', 'D', 'U'};
int n, m;
pair<int, int> A[maxn][maxn];
char ans[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  queue<pair<int, int> > q;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> A[i][j].first >> A[i][j].second;
      if (A[i][j] == (pair<int, int>){i, j}) {
        q.push({i, j});
        ans[i][j] = 'X';
      }
    }
  }
  while (!q.empty()) {
    auto [x, y] = q.front();
    q.pop();
    for (int i = 0; i < 4; ++i) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx < 1 || ny < 1 || nx > n || ny > n) continue;
      if (A[nx][ny] == A[x][y] && !ans[nx][ny]) {
        ans[nx][ny] = op[i];
        q.push({nx, ny});
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j)
      if (A[i][j] == (pair<int, int>){-1, -1} && !ans[i][j]) {
        for (int k = 0; k < 4; ++k) {
          int nx = i + dx[k];
          int ny = j + dy[k];
          if (nx < 1 || ny < 1 || nx > n || ny > n) continue;
          if (A[nx][ny] == (pair<int, int>){-1, -1} && !ans[i][j]) {
            ans[i][j] = opf[k];
          }
        }
      }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (!ans[i][j]) {
        cout << "INVALID" << endl;
        return 0;
      }
    }
  }
  cout << "VALID" << endl;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}
