#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<pair<int, int>>> a(n, vector<pair<int, int>>(n));
  vector<vector<bool>> vis(n, vector<bool>(n, 0));
  vector<vector<char>> ans(n, vector<char>(n, '?'));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j].first >> a[i][j].second;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (vis[i][j]) continue;
      if ((a[i][j].first == i + 1 && a[i][j].second == j + 1) ||
          a[i][j].first == -1) {
        ans[i][j] = 'X';
        queue<pair<int, int>> q;
        q.push({i, j});
        vis[i][j] = 1;
        while (!q.empty()) {
          pair<int, int> v = q.front();
          q.pop();
          for (int k = 0; k < 4; k++) {
            int xn = v.first + dx[k];
            int yn = v.second + dy[k];
            if (xn >= 0 && yn >= 0 && xn < n && yn < n && !vis[xn][yn] &&
                a[xn][yn] == a[i][j]) {
              q.push({xn, yn});
              vis[xn][yn] = 1;
              if (k == 0) ans[xn][yn] = 'U';
              if (k == 1) ans[xn][yn] = 'D';
              if (k == 2) ans[xn][yn] = 'L';
              if (k == 3) ans[xn][yn] = 'R';
              if (a[i][j].first == -1 && ans[i][j] == 'X') {
                if (k == 0) ans[i][j] = 'D';
                if (k == 1) ans[i][j] = 'U';
                if (k == 2) ans[i][j] = 'R';
                if (k == 3) ans[i][j] = 'L';
              }
            }
          }
        }
        if (a[i][j].first == -1 && ans[i][j] == 'X') {
          cout << "INVALID";
          return 0;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (ans[i][j] == '?') {
        cout << "INVALID";
        return 0;
      }
    }
  }
  cout << "VALID" << '\n';
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << ans[i][j];
    }
    cout << '\n';
  }
}
