#include <bits/stdc++.h>
#define I_can_AK int main
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vst = vector<string>;

const int MAXN = 1e6 + 5;

bool sz(const vector<vector<int>>& sb,int n){
	for(int i = 1; i <= n;i ++){
		for(int j = i-1;j >= 1;j--){
			if(sb[i][j]!=0) return false;
		}
	}
	return true;
}
void Solve(){
	int n;
	cin >> n ;
	vector<vector<int>>sb(n+2,vector<int>(n+2,0));
	for(int i = 1; i <= n; i++){
		for(int j = 1 ; j <= n ; j++){
			cin >> sb[i][j];
		}
	}
	if(sz(sb,n)) {
		cout << "YES" << endl;}
	else{
		cout <<"NO"<<endl;}
	return ;
}

I_can_AK(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr); std::cout.tie(nullptr);
	int _ = 1;
	//std::cin >> _;
	while(_--) Solve();
	return 0;
}