# Ask the user to input a number
num_rows = int(input("Enter the number of rows: "))

# Outer loop controls the number of rows
for i in range(1, num_rows + 1):
    # Inner loop controls the elements in each row
    for j in range(1, i + 1):
        # Print the current element followed by a space
        print(j, end=" ")
    
    # Move to the next line after printing each row
    print()