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