#include<stdio.h>
int main()
{
    int a, b=0,n;
    scanf("%d", &n);
    int arr[10][10] = {0};
    for (int i = 0; i < n; i++)
    {
        for (int h = 0; h < n; h++)
        {
            scanf("%d", &arr[i][h]);
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int h = 0; h < n; h++)
        {
            if (i - h > 0 && arr[i][h] == 0)
                b++;
            /*if (i - h < 0 && arr[i][h] != 0)
                printf("NO\n"); break;*/
        }
    }
    if(b==((n-1)*(n))/2)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}