#include <iostream>
using namespace std;
int main()
{
int n;
int arr[10][10];
cin >> n;
int count = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> arr[i][j];
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (i > j)
{
if (arr[i][j] == 0)
{
count++;
}
}
}
}
if (count == n*(n - 1) / 2)
{
cout << "YES";
}
else
{
cout << "NO";
}
return 0;
}
using namespace std;
int main()
{
int n;
int arr[10][10];
cin >> n;
int count = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> arr[i][j];
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (i > j)
{
if (arr[i][j] == 0)
{
count++;
}
}
}
}
if (count == n*(n - 1) / 2)
{
cout << "YES";
}
else
{
cout << "NO";
}
return 0;
}