#include <bits/stdc++.h>
using namespace std;
int n;
int a[55][55];
void solve() {
  bool ans = 1;
  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= n; ++y) {
      if (a[x][y] == 1) continue;
      bool flag = 0;
      for (int s = 1; s <= n; ++s) {
        for (int t = 1; t <= n; ++t) {
          if (a[x][s] + a[t][y] == a[x][y]) {
            flag = 1;
            break;
          }
        }
      }
      if (!flag) ans = 0;
    }
  }
  printf("%s\n", ans ? "YES" : "NO");
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  solve();
}
