n | matrix = [] | n | a = [] |
| first_line = input().strip() | | first_line = input().strip() |
| N = len(first_line.split(',')) | | N = len(first_line.split(',')) |
n | matrix.append(first_line.split(',')) | n | a.append(first_line.split(',')) |
| for _ in range(N - 1): | | for _ in range(N - 1): |
| line = input().strip() | | line = input().strip() |
n | matrix.append(line.split(',')) | n | a.append(line.split(',')) |
| for row_index in range(len(matrix)): | | for i in range(len(a)): |
| col_index = 0 | | j = 0 |
| while row_index != col_index: | | while i != j: |
| print(matrix[row_index][col_index], end=',') | | print(a[i][j], end=',') |
| col_index += 1 | | j += 1 |
| if row_index == col_index and row_index == 0: | | if i == j and i == 0: |
| print(matrix[row_index][col_index], end='') | | print(a[i][j], end='') |
| else: | | else: |
n | print(matrix[row_index][col_index], end=',') | n | print(a[i][j], end=',') |
| row_index -= 1 | | i -= 1 |
| while row_index >= 0: | | while i >= 0: |
| if row_index != 0: | | if i != 0: |
| print(matrix[row_index][col_index], end=',') | | print(a[i][j], end=',') |
| else: | | else: |
t | print(matrix[row_index][col_index], end='') | t | print(a[i][j], end='') |
| row_index -= 1 | | i -= 1 |
| print() | | print() |