#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 1, i = 0, j = 0, k = 0, x = 0;
  int area[51][51] = {0};
  cin >> n;
  for (i = 0; i < n; i++)
    for (x = 0; x < n; x++) cin >> area[i][x];
  for (i = 0; i < n; i++)
    for (x = 0; x < n; x++)
      if (area[i][x] != 1) {
        m = 1;
        for (j = 0; j < n; j++) {
          if (j == i) continue;
          for (k = 0; k < n; k++) {
            if (k == x) continue;
            if (area[i][x] == area[j][x] + area[i][k]) {
              m = 0;
              break;
            }
          }
          if (m == 0) break;
        }
        if (m == 1) {
          cout << "NO" << endl;
          return 0;
        }
      }
  cout << "YES" << endl;
  return 0;
}
