还是f提前舒服

def print_pic(n):
    for i in range(1,n+1):
        for j in range(1,n+1):
            if j<=i:
                print(f"{j} ",end="")
        print()
        
while True:
    try:
        n = input()
        print_pic(int(n))
    except:
        break