#include <bits/stdc++.h>
const long long max9 = 10 + 1e9, max6 = 10 + 1e6, max12 = 10 + 1e12,
                max15 = 10 + 1e15;
const long long min6 = -1 * max6, min9 = -1 * max9, min12 = -1 * max12,
                min15 = -1 * max15;
const long long R = 7 + 1e9, NN = 10 + 1e5;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n][n];
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) cin >> a[i][j];
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (n); ++j) {
      bool A = false;
      if (a[i][j] == 1)
        continue;
      else {
        for (int c = (0); c < (n); ++c) {
          if (c == i) continue;
          for (int r = (0); r < (n); ++r) {
            if (r == j) continue;
            if (a[i][r] + a[c][j] == a[i][j]) {
              A = true;
              break;
            }
          }
          if (A) break;
        }
        if (!A) {
          cout << "NO";
          return 0;
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
