#include <bits/stdc++.h>
using namespace std;
bool flag = true;
char res[1010][1010];
int vis[1010][1010];
pair<int, int> aux[1010][1010];
string direcao = "UDLRX";
int dx, dy;
int N;
int cont;
void dfs(int x, int y, int d) {
  res[x][y] = direcao[d];
  vis[x][y] = true;
  cont++;
  if (x - 1 >= 0 and !vis[x - 1][y] and aux[x - 1][y].first == dx and
      aux[x - 1][y].second == dy)
    dfs(x - 1, y, 1);
  if (x + 1 < N and !vis[x + 1][y] and aux[x + 1][y].first == dx and
      aux[x + 1][y].second == dy)
    dfs(x + 1, y, 0);
  if (y - 1 >= 0 and !vis[x][y - 1] and aux[x][y - 1].first == dx and
      aux[x][y - 1].second == dy)
    dfs(x, y - 1, 3);
  if (y + 1 < N and !vis[x][y + 1] and aux[x][y + 1].first == dx and
      aux[x][y + 1].second == dy)
    dfs(x, y + 1, 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int x, y;
      cin >> x >> y;
      if (x != -1 and y != -1)
        aux[i][j] = make_pair(x - 1, y - 1);
      else
        aux[i][j] = make_pair(x, y);
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (vis[i][j]) continue;
      if (aux[i][j].first == i and aux[i][j].second == j) {
        cont = 0;
        dx = i;
        dy = j;
        dfs(i, j, 4);
      }
      if (aux[i][j].first == -1 and aux[i][j].second == -1) {
        cont = 0;
        dx = -1;
        dy = -1;
        dfs(i, j, 0);
        if (cont == 1) {
          flag = false;
        }
        if (flag) {
          int x = i;
          int y = j;
          if (x - 1 >= 0 and aux[x - 1][y].first == dx and
              aux[x - 1][y].second == dy)
            res[i][j] = 'U';
          else if (x + 1 < N and aux[x + 1][y].first == dx and
                   aux[x + 1][y].second == dy)
            res[i][j] = 'D';
          else if (y - 1 >= 0 and aux[x][y - 1].first == dx and
                   aux[x][y - 1].second == dy)
            res[i][j] = 'L';
          else if (y + 1 < N and aux[x][y + 1].first == dx and
                   aux[x][y + 1].second == dy)
            res[i][j] = 'R';
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (!vis[i][j]) {
        flag = false;
      }
    }
  }
  if (!flag) {
    cout << "INVALID" << endl;
    return 0;
  }
  cout << "VALID" << endl;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cout << res[i][j];
    }
    cout << endl;
  }
}
