• 注意:两层for循环中的break的退出,是退出一层,不是退出两层。。。
n = int(input())
lines = []
for i in range(n):
    temp = list(map(int,input().split()))
    lines.append(temp)
flag = 0
for i in range(n):
    for j in range(0,i):
        if lines[i][j] != 0:
            print("NO")
            flag = 1
            break
    if flag == 1:
        break
else:
    print("YES")