#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool vis[1003][1003];
int main() {
  const string V = "VALID";
  const string I = "INVALID";
  const char U = 'U', D = 'D', L = 'L', R = 'R', X = 'X';
  int n;
  cin >> n;
  vector<vector<int>> x(n, vector<int>(n));
  vector<vector<int>> y(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> x[i][j] >> y[i][j];
      if (x[i][j] != -1 || y[i][j] != -1) {
        x[i][j]--;
        y[i][j]--;
      }
    }
  }
  vector<string> ans(n, string(n, '?'));
  auto print_ans = [&]() {
    bool valid = true;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        valid &= ans[i][j] != '?';
      }
    }
    if (!valid) {
      cout << I << endl;
      exit(0);
    }
    cout << V << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << ans[i][j];
      }
      cout << endl;
    }
    exit(0);
  };
  auto check_pos = [&n](int i, int j) {
    if (!(0 <= i && i < n)) return false;
    if (!(0 <= j && j < n)) return false;
    return true;
  };
  auto deb = [&]() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cerr << ans[i][j];
      }
      cerr << endl;
    }
    cerr << endl;
  };
  bool allinf = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      allinf &= x[i][j] == -1 && y[i][j] == -1;
    }
  }
  if (allinf) {
    if (n > 1) {
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
          ans[i][j] = R;
        }
      }
      for (int i = 0; i < n; i++) ans[i][n - 1] = D;
      for (int j = 1; j < n; j++) ans[n - 1][j] = L;
      ans[n - 1][0] = U;
    }
    print_ans();
    return 0;
  }
  deque<pair<int, int>> que;
  vector<vector<pair<int, int>>> cur(n, vector<pair<int, int>>(n, {-1, -1}));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (x[i][j] == i && y[i][j] == j) {
        que.emplace_back(i, j);
        ans[i][j] = X;
        cur[i][j] = {i, j};
        vis[i][j] = true;
      }
    }
  }
  vector<int> dr = {-1, 1, 0, 0}, dc = {0, 0, 1, -1};
  string udrl = "UDRL";
  string dulr = "DULR";
  while (!que.empty()) {
    auto p = que.front();
    que.pop_front();
    int r = p.first;
    int c = p.second;
    for (int t = 0; t < 4; t++) {
      int nr = p.first + dr[t];
      int nc = p.second + dc[t];
      if (!check_pos(nr, nc)) continue;
      if (vis[nr][nc]) continue;
      if (x[nr][nc] == cur[r][c].first && y[nr][nc] == cur[r][c].second) {
        que.emplace_back(nr, nc);
        ans[nr][nc] = dulr[t];
        cur[nr][nc] = {x[r][c], y[r][c]};
        vis[nr][nc] = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (x[i][j] != -1 || y[i][j] != -1) continue;
      if (ans[i][j] != '?') continue;
      for (int t = 0; t < 4; t++) {
        int nr = i + dr[t];
        int nc = j + dc[t];
        if (!check_pos(nr, nc)) continue;
        if (x[nr][nc] != -1 || y[nr][nc] != -1) continue;
        if (ans[nr][nc] != '?') continue;
        ans[i][j] = udrl[t];
        ans[nr][nc] = dulr[t];
        que.emplace_back(i, j);
        que.emplace_back(nr, nc);
        break;
      }
    }
  }
  while (!que.empty()) {
    auto p = que.front();
    que.pop_front();
    int r = p.first;
    int c = p.second;
    for (int t = 0; t < 4; t++) {
      int nr = p.first + dr[t];
      int nc = p.second + dc[t];
      if (!check_pos(nr, nc)) continue;
      if (x[nr][nc] != -1 || y[nr][nc] != -1) continue;
      if (ans[nr][nc] != '?') continue;
      ans[nr][nc] = dulr[t];
      que.emplace_back(nr, nc);
    }
  }
  print_ans();
  return 0;
}
