#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  int t, p;
  int flag = 0;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      t = a[i][j];
      flag = 0;
      pos = 0;
      if (t != 1) {
        for (int k = 0; k < n; k++) {
          p = a[k][j];
          for (int l = 0; l < n; l++) {
            if ((t == a[i][l] + p) && k != i && l != j) pos = 1;
          }
        }
        if (!pos) {
          flag = 1;
          goto x;
        }
      }
    }
  }
x:
  if (flag == 1)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
