#include<stdio.h>
int main() {
    int arr[10][10] = { 0 };
    int i = 0;
    int j = 0;
    int n = 0;
    scanf("%d", &n);
    int sum = 0;
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            scanf("%d", &arr[i][j]);
            while (i > j) {
                sum += arr[i][j];
                break;
            }
        }
    }
    if (sum == 0) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}