#include <bits/stdc++.h>
using namespace std;
template <typename T, typename V>
ostream &operator<<(ostream &out, const pair<T, V> x) {
  out << "{" << x.first << " : " << x.second << "}";
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const set<T> x) {
  for (auto &it : x) {
    out << it << " ";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const multiset<T> x) {
  for (auto &it : x) {
    out << it << " ";
  }
  return out;
}
template <typename T, typename V>
ostream &operator<<(ostream &out, const map<T, V> x) {
  for (auto &it : x) {
    out << "[" << it.first << "]"
        << " = " << it.second << "\n";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> x) {
  for (int i = 0; i < x.size() - 1; ++i) {
    out << x[i] << " ";
  }
  out << x.back();
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<vector<T> > x) {
  for (int i = 0; i < x.size() - 1; ++i) {
    out << "[" << i << "]"
        << " = {" << x[i] << "}\n";
  }
  out << "[" << x.size() - 1 << "]"
      << " = {" << x.back() << "}\n";
  return out;
}
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
const int INF = 1e9;
pair<long long, long long> x[1005][1005];
char ans[1005][1005];
int n;
void bfs(int i, int j) {
  if (!ans[i + 1][j] && x[i][j] == x[i + 1][j]) {
    ans[i + 1][j] = 'U';
    bfs(i + 1, j);
  }
  if (!ans[i - 1][j] && x[i][j] == x[i - 1][j]) {
    ans[i - 1][j] = 'D';
    bfs(i - 1, j);
  }
  if (!ans[i][j + 1] && x[i][j] == x[i][j + 1]) {
    ans[i][j + 1] = 'L';
    bfs(i, j + 1);
  }
  if (!ans[i][j - 1] && x[i][j] == x[i][j - 1]) {
    ans[i][j - 1] = 'R';
    bfs(i, j - 1);
  }
}
bool check(int i, int j) {
  if (x[i - 1][j] == (pair<long long, long long>){-1, -1}) {
    ans[i][j] = 'U';
    return true;
  }
  if (x[i][j - 1] == (pair<long long, long long>){-1, -1}) {
    ans[i][j] = 'L';
    return true;
  }
  if (x[i + 1][j] == (pair<long long, long long>){-1, -1}) {
    ans[i][j] = 'D';
    return true;
  }
  if (x[i][j + 1] == (pair<long long, long long>){-1, -1}) {
    ans[i][j] = 'R';
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < 1005; ++i) {
    for (int j = 0; j < 1005; ++j) {
      x[i][j] = {-2, -2};
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> x[i][j].first >> x[i][j].second;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i == x[i][j].first && j == x[i][j].second) {
        ans[i][j] = 'X';
        bfs(i, j);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (x[i][j] == (pair<long long, long long>){-1, -1}) {
        if (!check(i, j)) {
          cout << "INVALID";
          return 0;
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (ans[i][j] == 0) {
        cout << "INVALID";
        return 0;
      }
    }
  }
  cout << "VALID\n";
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << ans[i][j];
    }
    cout << "\n";
  }
  return 0;
}
