#include <bits/stdc++.h>
using namespace std;
int a[1000][1000], b[10000];
int main() {
  int i, ct = 0, n, m = 0, x, j, k, l, ck;
  cin >> n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) cin >> a[i][j];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (a[i][j] != 1) {
        ck = 0;
        for (k = 0; k < n; k++) {
          for (l = 0; l < n; l++) {
            if (a[k][j] + a[i][l] == a[i][j]) {
              ck = 1;
              goto read;
            }
          }
        }
      read:
        if (ck == 0) {
          cout << "NO" << endl;
          return 0;
        }
      }
    }
  }
  cout << "YES" << endl;
}
