#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  for (; b; a %= b, swap(a, b))
    ;
  return a;
}
const int N = 5000050;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
pair<int, int> board[1002][1002];
char Road[1002][1002];
bool hasAns = true;
int n;
bool Minus(int x, int y) {
  bool flag = false;
  for (int i = 0; i < 4; i++) {
    int cx = x + dx[i];
    int cy = y + dy[i];
    if (cx < 0 || cx >= n || cy < 0 || cy >= n) continue;
    if (board[cx][cy].first != -1) continue;
    flag = true;
    if (cx == x + 1)
      Road[x][y] = 'D';
    else if (cx == x - 1)
      Road[x][y] = 'U';
    else if (cy == y + 1)
      Road[x][y] = 'R';
    else
      Road[x][y] = 'L';
    break;
  }
  return flag;
}
void dfs(int x, int y, int xval, int yval) {
  for (int i = 0; i < 4; i++) {
    int cx = x + dx[i], cy = y + dy[i];
    if (cx < 0 || cx >= n || cy < 0 || cy >= n) continue;
    if (board[cx][cy].first == xval && board[cx][cy].second == yval &&
        Road[cx][cy] == '\0') {
      if (i == 0) Road[cx][cy] = 'U';
      if (i == 1) Road[cx][cy] = 'D';
      if (i == 2) Road[cx][cy] = 'L';
      if (i == 3) Road[cx][cy] = 'R';
      dfs(cx, cy, xval, yval);
    }
  }
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int x, y;
      cin >> x >> y;
      board[i][j] = {x, y};
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (board[i][j].first == -1 && Road[i][j] == '\0') hasAns &= Minus(i, j);
      if (board[i][j].first == i + 1 && board[i][j].second == j + 1) {
        Road[i][j] = 'X';
        dfs(i, j, i + 1, j + 1);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (Road[i][j] == '\0') {
        hasAns = false;
      }
    }
  }
  if (!hasAns)
    cout << "INVALID";
  else {
    cout << "VALID"
         << "\n";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << Road[i][j];
      }
      cout << "\n";
    }
  }
}
