#include <bits/stdc++.h>
using namespace std;
long long INF = 1e9 + 7;
long long MOD = 998244353;
bool in(long long i, long long j, long long n) {
  return min(i, j) >= 0 && max(i, j) < n;
}
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long x[n][n], y[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> x[i][j] >> y[i][j];
      }
    }
    char ans[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        ans[i][j] = 'A';
      }
    }
    map<pair<long long, long long>, vector<pair<long long, long long> > > mp;
    set<pair<long long, long long> > m;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (x[i][j] == i + 1 && y[i][j] == j + 1) {
          ans[i][j] = 'X';
        }
        mp[pair<long long, long long>(x[i][j], y[i][j])].push_back(
            pair<long long, long long>(i, j));
        m.insert(pair<long long, long long>(x[i][j], y[i][j]));
      }
    }
    long long dx[4] = {0, 0, -1, 1};
    long long dy[4] = {1, -1, 0, 0};
    char p[4] = {'R', 'L', 'U', 'D'};
    string s = "VALID";
    bool ok = 1;
    for (auto Y : m) {
      if (Y.first == -1) {
        for (auto xx : mp[Y]) {
          bool ok2 = 0;
          for (int h = 0; h < 4; h++) {
            long long i = xx.first + dx[h], j = xx.second + dy[h];
            if (in(i, j, n) && x[i][j] == -1) {
              ans[xx.first][xx.second] = p[h];
              ok2 = 1;
              break;
            }
          }
          if (!ok2) {
            ok = 0;
            s = "INVALID";
          }
        }
      } else {
        queue<pair<long long, long long> > q;
        q.push(pair<long long, long long>(Y.first - 1, Y.second - 1));
        long long posa = 0;
        while (!q.empty()) {
          posa++;
          long long i = q.front().first, j = q.front().second;
          q.pop();
          for (int h = 0; h < 4; h++) {
            long long xx = i + dx[h], yy = j + dy[h];
            if ((in(xx, yy, n) && x[xx][yy] == Y.first) &&
                (y[xx][yy] == Y.second && ans[xx][yy] == 'A')) {
              q.push(pair<long long, long long>(xx, yy));
              for (int h2 = 0; h2 < 4; h2++) {
                if (xx + dx[h2] == i && yy + dy[h2] == j) {
                  ans[xx][yy] = p[h2];
                }
              }
            }
          }
        }
        if (posa != mp[Y].size() || ans[Y.first - 1][Y.second - 1] != 'X') {
          ok = 0;
          s = "INVALID";
          break;
        }
      }
    }
    cout << s << "\n";
    if (ok) {
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          cout << ans[i][j];
        }
        cout << "\n";
      }
    }
  }
}
