n = int(input()) li = [] flag = 0 for i in range(n): li += list(map(int, input().split()[0:i])) #获取所有对角线以下的数字 for j in li: if j != 0: flag = 1 print("NO") break if flag == 0: print("YES")