#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[51][51];
  int b[52][2];
  int n, i, j, x, y;
  bool flag = true, f;
  memset(a, 0, sizeof(a));
  cin >> n;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) cin >> a[i][j];
  for (i = 0; i < n && (flag); i++)
    for (j = 0; j < n; j++) {
      if (a[i][j] != 1) {
        f = false;
        x = 0;
        y = 0;
        for (int k = 0; k < n; k++) {
          if (a[i][k] < a[i][j]) b[x++][0] = a[i][k];
          if (a[k][j] < a[i][j]) b[y++][1] = a[k][j];
        }
        for (int k = 0; k < x && (f == false); k++)
          for (int m = 0; m < y; m++) {
            if (b[k][0] + b[m][1] == a[i][j]) {
              f = true;
              break;
            }
          }
        if (f == false) {
          flag = false;
          break;
        }
      }
    }
  if (flag) {
    cout << "YES";
  } else
    cout << "NO";
  return 0;
}
