#include <bits/stdc++.h>
using namespace std;
int main() {
  int b, ans = 0;
  cin >> b;
  int a[b][b];
  for (int h = 0; h < b; h++)
    for (int g = 0; g < b; g++) cin >> a[h][g];
  for (int i = 0; i < b; i++) {
    for (int j = 0; j < b; j++) {
      if (a[i][j] != 1) {
        ans = 0;
        for (int x = 0; x < b; x++) {
          for (int y = 0; y < b; y++) {
            if (a[i][x] + a[y][j] == a[i][j]) ans = 1;
          }
        }
        if (ans == 0) {
          cout << "NO";
          return 0;
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
