N=int(input()) ans=[] for i in range(N): d=int(input()) B=int("9"*d) S=int("9"*(d-1)) ans.append(B-S) for i in range(N): print(ans[i])