N = int(input()) for i in range(N): d = int(input()) print(int("9" * d) - int("9" * (d - 1)))