#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int n;
int x[maxn][maxn], y[maxn][maxn];
char maze[maxn][maxn];
int connect(int i, int j, int r, int s, char c1, char c2) {
  if (x[r][s] == -1) {
    maze[i][j] = c1;
    if (maze[r][s] == '\0') maze[r][s] = c2;
    return 1;
  }
  return 0;
}
void dfs(int i, int j, char c) {
  if (maze[i][j] != '\0') return;
  maze[i][j] = c;
  if (x[i + 1][j] == x[i][j] && y[i + 1][j] == y[i][j]) dfs(i + 1, j, 'U');
  if (x[i - 1][j] == x[i][j] && y[i - 1][j] == y[i][j]) dfs(i - 1, j, 'D');
  if (x[i][j + 1] == x[i][j] && y[i][j + 1] == y[i][j]) dfs(i, j + 1, 'L');
  if (x[i][j - 1] == x[i][j] && y[i][j - 1] == y[i][j]) dfs(i, j - 1, 'R');
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> x[i][j] >> y[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (x[i][j] == -1) {
        bool res = (maze[i][j] != '\0');
        if (!res) res = connect(i, j, i, j + 1, 'R', 'L');
        if (!res) res = connect(i, j, i + 1, j, 'D', 'U');
        if (!res) res = connect(i, j, i, j - 1, 'L', 'R');
        if (!res) res = connect(i, j, i - 1, j, 'U', 'D');
        if (!res) {
          cout << "INVALID\n";
          return 0;
        }
      } else if (x[i][j] == i && y[i][j] == j)
        dfs(i, j, 'X');
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (maze[i][j] == '\0') {
        cout << "INVALID\n";
        return 0;
      }
    }
  cout << "VALID\n";
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << maze[i][j];
    cout << endl;
  }
  return 0;
}
