#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int m, n, p;
int x[maxn][maxn], y[maxn][maxn];
char g[maxn][maxn];
inline void pan(int p, int q, int r, int s, char d1, char d2) {
  if (x[r][s] == -1) {
    g[p][q] = d1;
    if (g[r][s] == '\0') {
      g[r][s] = d2;
    }
  }
}
void dfs(int p, int q, char d) {
  if (g[p][q] != '\0') {
    return;
  }
  g[p][q] = d;
  if (x[p][q] == x[p + 1][q] && y[p][q] == y[p + 1][q]) {
    dfs(p + 1, q, 'U');
  }
  if (x[p][q] == x[p][q + 1] && y[p][q] == y[p][q + 1]) {
    dfs(p, q + 1, 'L');
  }
  if (x[p][q] == x[p - 1][q] && y[p][q] == y[p - 1][q]) {
    dfs(p - 1, q, 'D');
  }
  if (x[p][q] == x[p][q - 1] && y[p][q] == y[p][q - 1]) {
    dfs(p, q - 1, 'R');
  }
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= n; j++) {
      scanf("%d%d", &x[i][j], &y[i][j]);
    }
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= n; j++) {
      if (x[i][j] == -1) {
        if (g[i][j] == '\0') {
          pan(i, j, i + 1, j, 'D', 'U');
        }
        if (g[i][j] == '\0') {
          pan(i, j, i, j + 1, 'R', 'L');
        }
        if (g[i][j] == '\0') {
          pan(i, j, i - 1, j, 'U', 'D');
        }
        if (g[i][j] == '\0') {
          pan(i, j, i, j - 1, 'L', 'R');
        }
        if (g[i][j] == '\0') {
          printf("INVALID\n");
          return 0;
        }
      } else if (x[i][j] == i && y[i][j] == j) {
        dfs(i, j, 'X');
      }
    }
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= n; j++) {
      if (g[i][j] == '\0') {
        printf("INVALID\n");
        return 0;
      }
    }
  }
  printf("VALID\n");
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= n; j++) {
      printf(j == n ? "%c\n" : "%c", g[i][j]);
    }
  }
  return 0;
}
