s = 'is2 Thi1s T4est 3a'
res = ' '.join(sorted(s.split(), key=lambda x: next(c for c in x if c.isdigit())))
print(res)