#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int>> v;
map<pair<long long int, long long int>, pair<long long int, long long int>> mp;
char ans[1005][1005];
long long int n, ch[1005][1005], tx[1005][1005], ty[1005][1005];
map<pair<long long int, long long int>, long long int> mp3;
long long int bfs() {
  long long int i, j, l, x, y, x1, y1, c;
  l = v.size();
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if ((tx[i][j] == i) && (ty[i][j] == j)) {
        x = i;
        y = j;
        queue<pair<long long int, long long int>> q;
        q.push({x, y});
        ans[x][y] = 'X';
        ch[x][y]++;
        while (!q.empty()) {
          pair<long long int, long long int> cp;
          cp = q.front();
          q.pop();
          x1 = cp.first;
          y1 = cp.second;
          if ((x1 - 1 > 0) && (ch[x1 - 1][y1] == 0)) {
            if ((tx[x1 - 1][y1] == x) && (ty[x1 - 1][y1] == y)) {
              ans[x1 - 1][y1] = 'D';
              q.push({x1 - 1, y1});
              ch[x1 - 1][y1]++;
            }
          }
          if ((x1 + 1 <= n) && (ch[x1 + 1][y1] == 0)) {
            if ((tx[x1 + 1][y1] == x) && (ty[x1 + 1][y1] == y)) {
              ans[x1 + 1][y1] = 'U';
              q.push({x1 + 1, y1});
              ch[x1 + 1][y1]++;
            }
          }
          if ((y1 - 1 > 0) && (ch[x1][y1 - 1] == 0)) {
            if ((tx[x1][y1 - 1] == x) && (ty[x1][y1 - 1] == y)) {
              ans[x1][y1 - 1] = 'R';
              q.push({x1, y1 - 1});
              ch[x1][y1 - 1]++;
            }
          }
          if ((y1 + 1 <= n) && (ch[x1][y1 + 1] == 0)) {
            if ((tx[x1][y1 + 1] == x) && (ty[x1][y1 + 1] == y)) {
              ans[x1][y1 + 1] = 'L';
              q.push({x1, y1 + 1});
              ch[x1][y1 + 1]++;
            }
          }
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if ((tx[i][j] == -1) && (ty[i][j] == -1)) {
        c = 0;
        if (i - 1 > 0) {
          if (tx[i - 1][j] == -1) {
            ans[i][j] = 'U';
            c++;
          }
        }
        if (i + 1 <= n) {
          if (tx[i + 1][j] == -1) {
            ans[i][j] = 'D';
            c++;
          }
        }
        if (j - 1 > 0) {
          if (tx[i][j - 1] == -1) {
            ans[i][j] = 'L';
            c++;
          }
        }
        if (j + 1 <= n) {
          if (tx[i][j + 1] == -1) {
            ans[i][j] = 'R';
            c++;
          }
        }
        if (c == 0) {
          cout << "INVALID";
          return 0;
        } else {
          ch[i][j]++;
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (ch[i][j] == 0) {
        cout << "INVALID";
        return 0;
      }
    }
  }
  cout << "VALID\n";
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cout << ans[i][j];
    }
    cout << "\n";
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, j, x, y;
  cin >> n;
  map<pair<long long int, long long int>, long long int> mp2;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cin >> x >> y;
      tx[i][j] = x;
      ty[i][j] = y;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      x = tx[i][j];
      y = ty[i][j];
      if (x != -1 && y != -1) {
        if ((tx[x][y] != x) || (ty[x][y] != y)) {
          cout << "INVALID";
          return 0;
        }
      }
    }
  }
  bfs();
}
