#include <bits/stdc++.h>
using namespace std;
bool IsPowerOfTwo(long long int x) { return (x != 0) && ((x & (x - 1)) == 0); }
long long int poer(long long int a, long long int b) {
  long long int rs = 1;
  while (b > 0) {
    if (b & 1) rs *= a;
    a *= a;
    b /= 2;
  }
  return rs;
}
long long int mod_poer(long long int a, long long int b, long long int mo) {
  long long int rs = 1;
  while (b > 0) {
    if (b & 1) rs = (rs * a) % mo;
    a = (a * a) % mo;
    b /= 2;
  }
  return rs % mo;
}
long long int d, x, y;
void ext_euclid(long long int a, long long int b) {
  if (b == 0) {
    d = a;
    x = 1;
    y = 0;
  } else {
    ext_euclid(b, a % b);
    long long int temp = x;
    x = y;
    y = temp - (a / b) * y;
  }
}
long long int mod_inverse1(long long int a, long long int m) {
  ext_euclid(a, m);
  return (x % m + m) % m;
}
long long int mod_inverse2(long long int a, long long int m) {
  return mod_poer(a, m - 2, m);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int mat[55][55];
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; ++j) cin >> mat[i][j];
  set<long long int> s[2550];
  long long int co = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < n; ++j) {
      {
        for (long long int g = 0; g < n; ++g)
          for (long long int h = 0; h < n; ++h) {
            if (g == i || h == j)
              continue;
            else {
              s[co].insert(mat[i][h] + mat[g][j]);
            }
          }
      }
      co++;
    }
  }
  long long int cnt = 0;
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < n; ++j) {
      if (mat[i][j] != 1 && s[cnt].find(mat[i][j]) == s[cnt].end()) {
        cout << "No" << endl;
        return 0;
      }
      cnt++;
    }
  cout << "Yes" << endl;
  return 0;
}
