#include <bits/stdc++.h>
using namespace std;
int a[1001][1001], vis[1001][1001], n;
pair<int, int> p[1002][1002];
char c[1001][1001];
void dfs(int i, int j, int fir, int sec, char ch) {
  if (i < 1 || j < 1 || i > n || j > n || p[i][j].first != fir ||
      p[i][j].second != sec || vis[i][j])
    return;
  vis[i][j] = 1;
  c[i][j] = ch;
  dfs(i - 1, j, fir, sec, 'D');
  dfs(i, j - 1, fir, sec, 'R');
  dfs(i + 1, j, fir, sec, 'U');
  dfs(i, j + 1, fir, sec, 'L');
  return;
}
char func(int i, int j) {
  if (p[i - 1][j].first == -1) return 'U';
  if (p[i + 1][j].first == -1) return 'D';
  if (p[i][j - 1].first == -1) return 'L';
  if (p[i][j + 1].first == -1) return 'R';
  return 'Z';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < 1001; i++)
    for (int j = 0; j < 1001; j++) c[i][j] = 'Z';
  int res = 0;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> p[i][j].first >> p[i][j].second;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == p[i][j].first && j == p[i][j].second)
        dfs(i, j, i, j, 'X');
      else if (p[i][j].first == -1 && p[i][j].second == -1)
        c[i][j] = func(i, j);
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (c[i][j] == 'Z') res = 1;
  if (res) {
    cout << "INVALID\n";
    return 0;
  }
  cout << "VALID\n";
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << c[i][j];
    cout << "\n";
  }
  return 0;
}
