#include <bits/stdc++.h>
using namespace std;
int a[100][100], n, row[55][100005], col[55][100005];
bool valid(int i, int j) {
  for (int k = 0; k < n; k++) {
    if (k == i) continue;
    int x = a[i][j] - a[k][j];
    if (x > 0 && row[i][x] && (x != a[i][j] || row[i][x] > 1)) return 1;
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
      row[i][a[i][j]]++;
      col[j][a[i][j]]++;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (a[i][j] != 1 && !valid(i, j)) {
        printf("No\n");
        return 0;
      }
  printf("Yes\n");
}
