#include <bits/stdc++.h>
using namespace std;
int grid[100][100] = {};
int main() {
  int n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    for (long long q = 0; q < n; ++q) {
      cin >> grid[i][q];
    }
  }
  for (long long i = 0; i < n; ++i) {
    for (long long q = 0; q < n; ++q) {
      if (grid[i][q] != 1) {
        for (long long j = 0; j < n; ++j) {
          for (long long t = 0; t < n; ++t) {
            if (grid[i][q] == grid[i][j] + grid[t][q]) goto ok;
          }
        }
        cout << "NO" << endl;
        return 0;
      }
    ok:;
    }
  }
  cout << "YES" << endl;
}
