num=int(input("Enter the number of row:"))
for row in range(num):
    for col in range(row + 1):
        x=0
        for k in range(col):
            x=x+num-k
        if col%2==0:
            print(x+row+1-col, end=" ")
        else:
            print(x+num-row,end=" ")
    print()

c403737b485bf773733b5ca6a3e53e1450e3392d
<mask token>

<mask token>
for row in range(num):
    for col in range(row + 1):
        x = 0
        for k in range(col):
            x = x + num - k
        if col % 2 == 0:
            print(x + row + 1 - col, end=' ')
        else:
            print(x + num - row, end=' ')
    print()

num = int(input('Enter the number of row:'))
for row in range(num):
    for col in range(row + 1):
        x = 0
        for k in range(col):
            x = x + num - k
        if col % 2 == 0:
            print(x + row + 1 - col, end=' ')
        else:
            print(x + num - row, end=' ')
    print()

num=int(input("Enter the number of row:"))
for row in range(num):
    for col in range(row + 1):
        x=0
        for k in range(col):
            x=x+num-k
        if col%2==0:
            print(x+row+1-col, end=" ")
        else:
            print(x+num-row,end=" ")
    print()
