n=int(input()) d=[int(input()) for i in range(n)] for i in range(n): if(d[i]==1): print(9) else: x=d[i]-1 a=x%10 b=x//10 print((10**b)**10*(10**a)*9)