#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k, sum = 0, a[100][100], b[100005], ans = 0;
  cin >> n;
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(n); ++j) cin >> a[i][j];
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(n); ++j) {
      if (a[i][j] != 1) {
        int flag = 0;
        for (int k = 0; k < int(n); ++k) {
          for (int l = 0; l < int(n); ++l)
            if (a[k][j] + a[i][l] == a[i][j]) {
              flag = 1;
              break;
            }
          if (flag) break;
        }
        if (!flag) {
          cout << "NO";
          return 0;
        }
      }
    }
  cout << "YES";
  return 0;
}
