#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int a[N][N];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int x = 0; x < n; x++) {
    for (int y = 0; y < n; y++) {
      if (a[x][y] != 1) {
        bool test = false;
        for (int s = 0; s < n; s++) {
          for (int t = 0; t < n; t++) {
            if (s == y || t == x) continue;
            test |= (a[x][y] == a[x][s] + a[t][y]);
          }
        }
        if (!test) return cout << "NO\n", 0;
      }
    }
  }
  cout << "YES\n";
  return 0;
}
