rows = int(input())
matrix = []
diagonal_sum = 0
for row in range(rows):
    matrix.append([int(el) for el in input().split()])
    diagonal_sum += matrix[row][row]
print(diagonal_sum)

767c6bc033e64fb519c09d04985bc8ff5dd98d2d
<mask token>

<mask token>
for row in range(rows):
    matrix.append([int(el) for el in input().split()])
    diagonal_sum += matrix[row][row]
print(diagonal_sum)

rows = int(input())
matrix = []
diagonal_sum = 0
for row in range(rows):
    matrix.append([int(el) for el in input().split()])
    diagonal_sum += matrix[row][row]
print(diagonal_sum)
