#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int s = 0;
  int a[50][50];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  int h = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i][j] != 1) {
        int e = 0;
        for (int q = 0; q < n; q++) {
          for (int w = 0; w < n; w++) {
            if (a[i][q] + a[w][j] == a[i][j]) {
              e++;
            }
          }
        }
        if (e == 0) {
          s++;
        }
      }
    }
  }
  if (s != 0) {
    cout << "NO";
  } else {
    cout << "YES";
  }
  return 0;
}
