#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
bool pri[1000001];
void sieve() {
  long long int i, j;
  for (i = 2; i * i <= 1000000; i++) {
    if (pri[i]) {
      for (j = i * i; j <= 1000000; j += i) pri[j] = 0;
    }
  }
}
long long int po(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int GCD(long long int A, long long int B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
long long int x[1001][1001], y[1001][1001];
char a[1001][1001];
bool c(long long int i, long long int j, long long int ii, long long int jj,
       char ic, char jc) {
  if (x[ii][jj] == -1) {
    a[i][j] = ic;
    if (a[ii][jj] == '\0') a[ii][jj] = jc;
    return 1;
  } else
    return 0;
}
void dfs(long long int i, long long int j, char ic) {
  if (a[i][j] != '\0') return;
  a[i][j] = ic;
  if (x[i][j] == x[i + 1][j] && y[i][j] == y[i + 1][j]) dfs(i + 1, j, 'U');
  if (x[i][j] == x[i - 1][j] && y[i][j] == y[i - 1][j]) dfs(i - 1, j, 'D');
  if (x[i][j] == x[i][j + 1] && y[i][j] == y[i][j + 1]) dfs(i, j + 1, 'L');
  if (x[i][j] == x[i][j - 1] && y[i][j] == y[i][j - 1]) dfs(i, j - 1, 'R');
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  long long int n, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) cin >> x[i][j] >> y[i][j];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (x[i][j] == -1) {
        bool f = (a[i][j] != '\0');
        if (f == 0) f = c(i, j, i + 1, j, 'D', 'U');
        if (f == 0) f = c(i, j, i - 1, j, 'U', 'D');
        if (f == 0) f = c(i, j, i, j - 1, 'L', 'R');
        if (f == 0) f = c(i, j, i, j + 1, 'R', 'L');
        if (f == 0) {
          cout << "INVALID" << endl;
          return 0;
        }
      } else if (x[i][j] == i && y[i][j] == j)
        dfs(i, j, 'X');
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (a[i][j] == '\0') {
        cout << "INVALID";
        return 0;
      }
    }
  }
  cout << "VALID" << endl;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) cout << a[i][j];
    cout << endl;
  }
}
