注意类型

n=input()
matrix_list=[]
for i in range(int(n)):
    matrix_val=input().split(" ")
    matrix_list.append(matrix_val)
flag=True
for i in range(int(n)):
    for j in range(i):
        if int(matrix_list[i][j])!=0:
            flag=False
if flag:
    print("YES")
else:
    print("NO")