#include<iostream> #include<vector> int main() { int n; std::cin>>n; std::vector<std::vector<int> > a(n+5, std::vector<int> (n+5)); for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) std::cin>>a[i][j]; int good=1 ; for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) if(a[i][j]!=1) { int chk=0; for(int r=1; r<=n; r++) for(int c=1; c<=n; c++) chk|=(a[i][r]+a[c][j]==a[i][j]); good&=chk ; } std::cout<< (good?"YES":"N0")<<std::endl; return 0; }