#include <bits/stdc++.h>
using std::map;
using std::max;
using std::min;
using std::set;
using std::sort;
using std::swap;
using std::vector;
inline int readInt() {
  int ans = 0;
  char c;
  do c = getchar();
  while (!isdigit(c));
  while (isdigit(c)) {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return ans;
}
const int N = 55;
int A[N][N];
int main() {
  int n = readInt();
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) A[i][j] = readInt();
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (A[i][j] != 1) {
        bool ok = false;
        for (int k = 0; k < n; ++k)
          if (i != k) {
            for (int l = 0; l < n; ++l)
              if (j != l && A[i][j] == A[k][j] + A[i][l]) {
                ok = true;
                break;
              }
            if (ok) break;
          }
        if (!ok) return puts("NO"), 0;
      }
  return puts("YES"), 0;
}
