Need Help regarding optimization of the following to avoid TLE

Problem Code is “KS2”
Here is the code:

T=int(input())
for i in range(1,T+1):
K=int(input())
cf=[19]
f=19

if(K==1):
    print(f)
else:
    while(K>0):#Arbitrary Condition
        f=f+1
        n=f
        s=0
        d=0
        while(n!=0):
            d=n%10
            s=s+d
            n=n//10
        if(s%10==0):
            cf.append(f)
        if(len(cf)==K):
            print(cf[-1])
            break