import numpy as np
nums=[]
f = open("5.txt", "r+")
index = -1
while True:
x = f.readline()
if len(x) == 0 : break
if x[0].isnumeric():
nums.append(x)
if index == -1:
index = f.tell()-len(x)-1
nums=np.sort(nums)
f.seek(index)
f.writelines(nums)
f.close()