#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} Load[2005][2005];
int N, M;
char Ans[2005][2005];
int get() {
  char ch;
  int v;
  bool f = 0;
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = 1;
  v = ch - '0';
  while (isdigit(ch = getchar())) v = v * 10 + ch - '0';
  return f ? -v : v;
}
void dfs(int i, int j, char Last) {
  if (Ans[i][j]) return;
  Ans[i][j] = Last;
  if (Load[i + 1][j].x == Load[i][j].x && Load[i + 1][j].y == Load[i][j].y)
    dfs(i + 1, j, 'U');
  if (Load[i - 1][j].x == Load[i][j].x && Load[i - 1][j].y == Load[i][j].y)
    dfs(i - 1, j, 'D');
  if (Load[i][j + 1].x == Load[i][j].x && Load[i][j + 1].y == Load[i][j].y)
    dfs(i, j + 1, 'L');
  if (Load[i][j - 1].x == Load[i][j].x && Load[i][j - 1].y == Load[i][j].y)
    dfs(i, j - 1, 'R');
  return;
}
void Work(int stax, int stay, int finx, int finy, char sta) {
  Ans[stax][stay] = sta;
  if (sta == 'U') Ans[finx][finy] = 'D';
  if (sta == 'D') Ans[finx][finy] = 'U';
  if (sta == 'L') Ans[finx][finy] = 'R';
  if (sta == 'R') Ans[finx][finy] = 'L';
  return;
}
int main() {
  N = get();
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) Load[i][j].x = get(), Load[i][j].y = get();
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++)
      if (Load[i][j].x == i && Load[i][j].y == j) dfs(i, j, 'X');
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) {
      if (Load[i][j].x == -1 && Load[i][j].y == -1 && Load[i + 1][j].x == -1 &&
          Load[i + 1][j].y == -1)
        Work(i, j, i + 1, j, 'D');
      if (Load[i][j].x == -1 && Load[i][j].y == -1 && Load[i - 1][j].x == -1 &&
          Load[i - 1][j].y == -1)
        Work(i, j, i - 1, j, 'U');
      if (Load[i][j].x == -1 && Load[i][j].y == -1 && Load[i][j - 1].x == -1 &&
          Load[i][j - 1].y == -1)
        Work(i, j, i, j - 1, 'L');
      if (Load[i][j].x == -1 && Load[i][j].y == -1 && Load[i][j + 1].x == -1 &&
          Load[i][j + 1].y == -1)
        Work(i, j, i, j + 1, 'R');
    }
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++)
      if (!Ans[i][j]) {
        cout << "INVALID";
        return 0;
      }
  cout << "VALID" << endl;
  for (int i = 1; i <= N; i++, printf("\n"))
    for (int j = 1; j <= N; j++) printf("%c", Ans[i][j]);
  return 0;
}
