There are $n$ digital panels placed in a straight line. Each panel can show any digit from $0$ to $9$. Initially, all panels show $0$.

Every second, the digit shown by each panel increases by $1$. In other words, at the end of every second, a panel that showed $9$ would now show $0$, a panel that showed $0$ would now show $1$, a panel that showed $1$ would now show $2$, and so on.

When a panel is paused, the digit displayed on the panel does not change in the subsequent seconds.

You must pause exactly one of these panels, at any second you wish. Then, the panels adjacent to it get paused one second later, the panels adjacent to those get paused $2$ seconds later, and so on. In other words, if you pause panel $x$, panel $y$ (for all valid $y$) would be paused exactly $|x−y|$ seconds later.

For example, suppose there are $4$ panels, and the $3$-rd panel is paused when the digit $9$ is on it.

The panel $1$ pauses $2$ seconds later, so it has the digit $1$;

the panel $2$ pauses $1$ second later, so it has the digit $0$;

the panel $4$ pauses $1$ second later, so it has the digit $0$.

The resulting $4$-digit number is $1090$. Note that this example is not optimal for $n = 4$.

Once all panels have been paused, you write the digits displayed on them from left to right, to form an $n$ digit number (it can consist of leading zeros). What is the largest possible number you can get? Initially, all panels show $0$.


-----Input-----

The first line of the input contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. Each test case consists of a single line containing a single integer $n$ ($1 \le n \le 2\cdot10^5$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $2\cdot10^5$.


-----Output-----

For each test case, print the largest number you can achieve, if you pause one panel optimally.


-----Examples-----

Input
2
1
2
Output
9
98


-----Note-----

In the first test case, it is optimal to pause the first panel when the number $9$ is displayed on it.

In the second test case, it is optimal to pause the second panel when the number $8$ is displayed on it.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Mathematics

Constructive algorithms


Solutions:
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		res = '989'
		n = n - 3
		s = '0123456789'
		res = res + s * (n // 10) + s[0:n % 10]
		print(res)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print(989, end='')
		if n <= 13:
			for i in range(n - 3):
				print(i, end='')
			print()
		else:
			s = '0123456789'
			p = (n - 3) // 10
			l = (n - 3) % 10
			print('0123456789' * p + s[:l], end='')
			print()


t = int(input())
for g in range(t):
	n = int(input())
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	elif n == 3:
		print('989')
	else:
		n -= 3
		s = '989'
		j = 0
		for i in range(n):
			s += str(j % 10)
			j += 1
		print(s)


for _ in range(int(input())):
	n = int(input())
	s = '9' + '8901234567' * n
	print(s[:n])


t = int(input())
for i in range(t):
	n = int(input())
	if n > 2:
		num1 = '989'
		num2 = '0123456789'
		output = num1 + num2 * ((n - 3) // 10) + num2[:(n - 3) % 10]
		print(output)
	elif n == 1:
		print(9)
	else:
		print(98)


t = int(input())
for i in range(t):
	n = int(input())
	m = '9' + '8901234567' * n
	print(m[:n])


for _ in range(int(input())):
	n = int(input())
	s = [0] * n
	if n <= 3:
		print('989'[:n])
	else:
		(s[0], s[1], s[2]) = ('9', '8', '9')
		x = 0
		for i in range(3, n):
			s[i] = str(x)
			x = (x + 1) % 10
		print(''.join(s))


w = '0123456789'
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print('989' + w * ((n - 3) // 10) + w[:(n - 3) % 10])


t = int(input())
s = '9012345678'
for i in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		rez = '98'
		rez += s * ((n - 2) // 10)
		rez += s[:(n - 2) % 10]
		print(rez)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print(989, end='')
		n -= 3
		for i in range(n):
			print(i % 10, end='')
	print()


def res_gen(cur_panel_number):
	value = 0
	if cur_panel_number == 1:
		yield '9'
		cur_panel_number = 0
	elif cur_panel_number == 2:
		yield '98'
		cur_panel_number = 0
	elif cur_panel_number >= 3:
		yield '989'
		cur_panel_number -= 3
	while cur_panel_number:
		yield str(value % 10)
		value += 1
		cur_panel_number -= 1
t = int(input())
inp_ns = []
for i in range(t):
	inp_ns.append(int(input()))
for inp_n in inp_ns:
	print(''.join(res_gen(inp_n)))


def solve(n):
	num = '989' + '0123456789' * n
	print(num[:n])
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


inf = '989' + '0123456789' * int(20000.0)
for _ in range(int(input())):
	n = int(input())
	print(inf[:n])


import math
for i in range(int(input())):
	n = int(input())
	a = '989'
	s = '0123456789'
	if n < 4:
		if n == 1:
			print(9)
		elif n == 2:
			print(98)
		elif n == 3:
			print(989)
	else:
		n = n - 3
		print(a + math.floor(n / 10) * s + s[:n % 10])


import math

def solve(n):
	if n == 1:
		return '9'
	elif n == 2:
		return '98'
	elif n == 3:
		return '989'
	else:
		ans = '989'
		n = n - 3
		tens = n // 10
		rema = n % 10
		ans += '0123456789' * tens
		l = ['9', '8', '7', '6', '5', '4', '3', '2', '1', '0']
		for i in range(rema):
			ans += l[9 - i]
		return ans
noOfTestCases = int(input())
for i in range(noOfTestCases):
	n = int(input())
	ans = solve(n)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		ans = '98'
		a = 9
		for i in range(n - 2):
			ans += str(a)
			a = (a + 1) % 10
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = '989' + '0123456789' * (n // 8 + 1)
	print(a[:n])


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		s = '9890123456789'
		print(s[:n])
	else:
		s = '0123456789'
		n -= 3
		h = n % 10
		k = n // 10
		p = '989' + k * s + s[:h]
		print(p)


t = int(input())
for _ in range(t):
	n = int(input())
	A = [0] * 200007
	for i in range(len(A)):
		A[i] = (8 + abs(i + 1 - 2)) % 10
	for i in range(n):
		print(A[i], end='')
	print()


from typing import List
import heapq
import json
import functools
from collections import deque
from functools import lru_cache
import collections
import random
import itertools
from itertools import product as product
from itertools import accumulate as accumulate
from itertools import accumulate as ac
from collections import defaultdict
from collections import Counter
from functools import cmp_to_key
import bisect
import math
import sys
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	ans = 0
	if n == 1:
		ans = 9
	if n == 2:
		ans = '98'
	if n == 3:
		ans = 989
	if n > 3:
		c = '0123456789'
		ans = '989'
		n -= 3
		(x, y) = divmod(n, 10)
		ans += '0123456789' * x
		i = 0
		if y:
			ans += c[:y]
	print(ans)


t = int(input())

def solve():
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		x = 0
		print(989, end='')
		for _ in range(n - 3):
			print(x, end='')
			x += 1
			if x == 10:
				x = 0
		print('')
while t:
	solve()
	t -= 1


import sys
import os
import math
import copy
import random
from bisect import bisect
from io import IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations, accumulate
import atexit, io, sys

@atexit.register
def write():
	buffer = io.BytesIO()
	sys.stdout = buffer
	sys.__stdout__.write(buffer.getvalue().decode('utf-8'))

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def watch(x):
	return print(x)

def common(l1, l2):
	return set(l1).intersection(l2)

def Most_frequent(list):
	return max(set(list), key=list.count)
for _ in range(int(input())):
	n = int(input())
	s = '989'
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(s)
	else:
		for i in range(n - 3):
			s = s + str(i % 10)
		print(s)


for _ in range(int(input())):
	n = int(input())
	s = '989'
	if n < 4:
		print(s[:n])
	else:
		print(s, end='')
		for i in range(3, n):
			print((i - 3) % 10, end='')
		print()


t = int(input())
while t > 0:
	n = int(input())
	s = ''
	if n == 1:
		s = '9'
	else:
		s = '98'
		i = 1
		while i <= n - 2:
			addnum = (8 + i) % 10
			s += str(addnum)
			i += 1
	print(s)
	t -= 1


import sys
import bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 9
	n = random.randint(1, N)
	A = [random.randint(1, n) for i in range(m)]
	return (n, A)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	n = I()
	t = 9
	print('98'[:n], end='')
	for i in range(n - 2):
		print(t, end='')
		t += 1
		if t == 10:
			t = 0
	print()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
from copy import deepcopy
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	if n == 1:
		out('9')
		continue
	if n == 2:
		out('98')
		continue
	if n == 3:
		out('989')
		continue
	answer = ['9', '8', '9']
	n -= 3
	temp = 0
	for i in range(n):
		answer.append(str(temp))
		temp = (temp + 1) % 10
	out(''.join(answer))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
i = 0

def soln(n):
	if n == 2:
		return '98'
	if n == 1:
		return '9'
	a = [8] * n
	a[1] = '8'
	a[2] = '9'
	a[0] = '9'
	for i in range(3, n):
		a[i] = str((a[i] + i - 1) % 10)
	return ''.join(a)
while i < t:
	i += 1
	n = inp()
	print(soln(n))


for _ in range(int(input())):
	x = '989'
	n = int(input())
	while len(x) <= n:
		x += '0123456789'
	print(x[:n])


t = int(input())
while t:
	t -= 1
	n = int(input())
	print(('9' + '8901234567' * n)[:n])


t = int(input())
for _ in range(0, t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		n -= 2
		s = '98'
		s1 = '9012345678'
		a = n // 10
		s += a * s1
		a = n % 10
		s += s1[:a]
		print(s)


t = int(input())
a = ['9', '8', '9']
for i in range(3, 2 * 10 ** 5 + 1):
	a.append(str((i - 3) % 10))
for _ in range(t):
	n = int(input())
	for i in range(n):
		print(a[i], end='')
	print()


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		sub = n - 3
		div = sub // 10
		rem = sub % 10
		s = '0123456789'
		print('989' + div * s + s[:rem])


for _ in range(int(input())):
	n = int(input())
	s = '989' + '0123456789' * ((n + 9) // 10)
	print(s[:n])


n = '989' + '0123456789' * 222222
for _ in range(int(input())):
	print(n[0:int(input())])


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		print(989, end='')
		a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
		for i in range(n - 3):
			print(a[i % 10], end='')
		print('')


import sys
input = sys.stdin.readline
tc = int(input())
tmp = [1, 2, 3, 4, 5, 6, 7, 8, 9]
tmp1 = [9, 8, 9]
for _ in range(tc):
	ls = []
	num = int(input())
	n = num
	idx = 0
	flag = True
	while True:
		if n == 0:
			break
		n -= 1
		if idx == 9:
			ls.append(0)
			idx = 0
			if flag != False:
				flag = False
		if flag == True:
			if idx == 2:
				ls.append(tmp1[idx])
				idx = 8
			else:
				ls.append(tmp1[idx])
		else:
			ls.append(tmp[idx])
		idx += 1
	for i in range(num):
		print(ls[i], end='')
	print()


num = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	else:
		print(num[9], end='')
		for j in range(n - 1):
			print(num[(j + 8) % 10], end='')
		print(' ')


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		if n == 1:
			print('9')
		elif n == 2:
			print('98')
		else:
			res = '98'
			i = 3
			cnt = 8
			while i <= n:
				t = (cnt + 1) % 10
				res += str(t)
				cnt = t
				i += 1
			print(res)
except:
	pass


import sys

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for _ in range(t):
	n = II()
	ans = '989'
	r = '0123456789'
	a = (n - 3) // 10
	ans += r * (a + 1)
	print(ans[:n])


x = int(input())
s = '989'
r = '0123456789'
for i in range(x):
	t = int(input())
	if t <= 3:
		print(s[:t])
	else:
		m = abs(3 - t)
		p = m // 10
		q = m % 10
		if q > 0:
			print(s + r[:m] * p + r[:q])
		else:
			print(s + r[:m] * p)


import math

def solve():
	n = int(input())
	res = '0123456789'
	if n == 1:
		print('9')
		return
	if n == 2:
		print('98')
		return
	if n == 3:
		print(989)
		return
	rem = n - 3
	q = math.ceil(rem / 10)
	res = res * q
	res = '989' + res[:rem]
	print(res)
	return
	return
t = int(input())
for _ in range(t):
	solve()


import math
t = int(input())
for i in range(t):
	n = int(input())
	j = 9
	firstdecrease = True
	for i in range(n):
		print(j, end='')
		if firstdecrease:
			j = (j - 1) % 10
		else:
			j = (j + 1) % 10
		if firstdecrease and j == 8:
			firstdecrease = False
	print()


for _ in range(int(input())):
	n = int(input())
	print(('9' + '8901234567' * (n // 10 + 1))[:n])


t = int(input())
for i in range(t):
	a = '989'
	b = '0123456789'
	n = int(input())
	if n <= 3:
		print(a[:n])
	else:
		n = n - 3
		rem = n % 10
		mul = n // 10
		a = a + mul * b + b[:rem]
		print(a)


m = int(input())
y = '989'
x = '0123456789'
for _ in range(m):
	n = int(input())
	if n <= 3:
		print(y[:n])
	else:
		a = (n - 3) // 10
		b = (n - 3) % 10
		print(y + x * a + x[:b])


t = int(input())
for i in range(t):
	n = int(input())
	init = '989'
	ext = '0123456789'
	print(init[:n], end='')
	if n > 3:
		iterations = (n - 3) // 10
		rest = (n - 3) % 10
		print(ext * iterations, end='')
		print(ext[:rest], end='')
	print('')


str = '989' + '0123456789' * 100000
for i in range(int(input())):
	print(str[:int(input())])


s = '989' + '0123456789' * 20000
for _ in range(int(input())):
	n = int(input())
	print(s[:n])


for _ in range(int(input())):
	n = int(input())
	a = (n - 3) // 10
	b = (n - 3) % 10
	s = '989'
	t = '0123456789'
	if n <= 3:
		print(s[0:n])
	else:
		print(s, end='')
		print(t * a + t[0:b])


entrada = int(input())
for _ in range(entrada):
	n = int(input())
	s = '0123456789'
	p = '989'
	if n // 3 > 0:
		t = (n - 3) // 10
		nMagico = s[0:(n - 3) % 10]
		print(p + s * t + nMagico)
	else:
		pausa = p[0:n % 3]
		print(pausa)


for _ in range(int(input())):
	n = int(input())
	s = '0123456789'
	p = '989'
	if n // 3 > 0:
		print(p + s * ((n - 3) // 10) + s[0:(n - 3) % 10])
	else:
		print(p[0:n % 3])


import math
from sys import stdin
from heapq import *
from itertools import permutations
from collections import Counter, OrderedDict, deque
inp = lambda : stdin.readline().strip()
ii = lambda : int(inp())
si = lambda : map(int, inp().split())
sf = lambda : map(float, inp().split())
li = lambda : list(si())
lf = lambda : list(sf())
lin = lambda : list(inp())
liin = lambda : [int(c) for c in inp()]
infy = float('inf')
mod = int(1000000000.0) + 7
test = ii()
for _ in range(test):
	n = ii()
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		ans = ['9', '8']
		for i in range(3, n + 1):
			ans.append(str((8 + (i - 2)) % 10))
		a = ''
		print(''.join(ans))


c = '0123456789'
st = '989'
d = dict()
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(st[:n])
	else:
		print(st, end='')
		n = n - 3
		z = n // 10
		print(z * c, end='')
		for i in range(n % 10):
			print(c[i], end='')
		print()


def solve():
	for _ in range(ii()):
		n = ii()
		s = '989'
		if n < 3:
			print(s[:n])
		else:
			b = ''.join(map(str, range(10)))
			if n > 3:
				(q, r) = divmod(n - 3, len(b))
				s += q * b + b[:r]
			print(s)
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
solve()


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
l = ['9', '8', '9']
k = 0
for i in range(2 * 10 ** 5):
	l.append(str(k))
	k += 1
	if k > 9:
		k = 0
for i in range(inp()):
	s = inp()
	print(''.join(l[:s]))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = '989'
	curr = 9
	end = '0123456789'
	mul = (n - 3) // 10
	plus = (n - 3) % 10
	if mul < 0:
		arr = arr[:n]
	else:
		arr = arr[:n] + end * mul + end[:plus]
	print(arr)


import math

def getlist():
	return [int(i) for i in input().split()]

def getmany():
	return map(int, input().split())

def getstr():
	return [str(i) for i in input().split()]

def solve():
	n = int(input())
	if n == 1:
		print(9)
		return
	if n == 2:
		print(98)
		return
	if n == 3:
		print(989)
		return
	s = '0123456789'
	time = (n - 3) // 10
	mod = (n - 3) % 10
	print('989' + s * time + s[0:mod])
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print('989', end='')
		x = 0
		for _ in range(4, n + 1):
			print(x, end='')
			x += 1
			if x == 10:
				x = 0
		print()


from math import ceil
t = int(input())
for k in range(t):
	n = int(input())
	final = '989' + '0123456789' * ceil(n / 10)
	print(final[:n])


for _ in range(int(input())):
	n = int(input())
	num = '9876543210'[::-1]
	res = '989'
	res = res + num * (n // 10) + num[:n % 10]
	res = res[:n]
	print(res)


t = int(input(''))
for dummy_case in range(t):
	n = int(input(''))
	num = 9
	i = 0
	while i < n:
		if i == 0:
			print(str(num % 10), end='')
			num -= 1
		else:
			print(str(num % 10), end='')
			num += 1
		i += 1
	print('')


T = int(input().strip())
for i in range(T):
	num = int(input().strip())
	if num == 1:
		print('9')
	elif num == 2:
		print('98')
	else:
		(x, y) = divmod(num - 3, 10)
		print('989' + ''.join(['0123456789' for i in range(x)]) + ''.join([str(i) for i in range(y)]))


from sys import stdin
s = '989' + '0123456789' * 100000
for _ in range(int(stdin.readline())):
	print(s[:int(stdin.readline())])


from sys import stdin
template = '0123456789'
start = '989'
for i in range(int(stdin.readline())):
	tmp = int(stdin.readline())
	if 3 <= tmp:
		result = start + template * ((tmp - 3) // 10) + template[:(tmp - 3) % 10]
	else:
		result = start[:tmp]
	print(result)


a = int(input())
for x in range(a):
	n = ''
	b = int(input())
	if b == 1:
		print(9)
	elif b == 2:
		print(98)
	else:
		n += '9'
		n += '8'
		n += '9'
		p = 0
		for y in range(b - 3):
			n += str(p)
			if p == 9:
				p = 0
			else:
				p = p + 1
		print(n)


from math import *
import threading
import sys
mod = 10 ** 9
inf = 10 ** 6
yes = 'YES'
no = 'NO'

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li

def primefactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors

def prod(li):
	ans = 1
	for i in li:
		ans *= i
	return ans

def dist(a, b):
	d = abs(a[1] - b[1]) + abs(a[2] - b[2])
	return d

def power_of_n(x, n):
	cnt = 0
	while x % n == 0:
		cnt += 1
		x //= n
	return cnt
import itertools
sys.setrecursionlimit(300000)
num = '0123456789'
num1 = '989'
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(num1[:n])
	else:
		print(num1, end='')
		n -= 3
		times = n // 10
		tleft = n % 10
		print(num * times, end='')
		print(num[:tleft])


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))
for _ in range(iinput()):
	n = iinput()
	s = '989'
	if n > 3:
		a = 0
		while a < n:
			s += '0123456789'
			a += 10
	print(s[:n])


for t in range(int(input())):
	n = int(input())
	string = '0123456789'
	if n < 4:
		print('989'[:n])
	else:
		x = (n - 3) // 10
		y = (n - 3) % 10
		if n - 3 < 10:
			x = 0
		ans = '989' + x * string + string[:y]
		print(ans)


import math

def main():
	t = int(input())
	for _ in range(t):
		print(case())

def case():
	n = int(input())
	x = '989'
	d = '0123456789'
	if n <= 3:
		return x[:n]
	else:
		return x + (n - 3) // 10 * d + d[:(n - 3) % 10]
main()


for _ in range(int(input())):
	n = int(input())
	num = ''
	p = 0
	for i in range(n):
		if i == 0:
			num += str(9)
		elif i == 1:
			num += str(8)
		elif i == 2:
			num += str(9)
		else:
			num += str(p)
			p = (p + 1) % 10
	print(num)


t = int(input())
for i in range(t):
	n = int(input())
	r = '989' + '0123456789' * n
	print(r[:n])


testc = int(input())
for t in range(testc):
	nump = int(input())
	val = 8
	print(9, end='')
	for i in range(1, nump):
		if val == 10:
			val = 0
		print(val, end='')
		val += 1
	print()


def solve(n):
	return ('98' + '9012345678' * n)[:n]
t = int(input())
for i in range(t):
	n = int(input())
	print(solve(n))


def solve(n):
	ans = '9890'
	if n <= 4:
		return ans[:n]
	else:
		for i in range(1, n - 3):
			ans += str(i % 10)
		return ans
for _ in range(int(input())):
	print(solve(int(input())))


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
		continue
	if n == 2:
		print(98)
		continue
	print(989, end='')
	for i in range(n - 3):
		print(i % 10, end='')
	print()


cases = int(input())
for z in range(cases):
	num = int(input())
	count = 0
	if num == 1:
		print('9')
	elif num == 2:
		print('98')
	elif num == 3:
		print('989')
	else:
		count = 0
		print('989', end='')
		maximum = 0
		while count < num - 3:
			print(maximum, end='')
			if maximum == 9:
				maximum = 0
			else:
				maximum += 1
			count += 1
		print('')


for _ in range(int(input())):
	n = int(input())
	panels = [0 for _ in range(n)]
	pause = min(len(panels), 1)
	for i in range(n):
		if i <= pause:
			panels[i] = (9 - i) % 10
		else:
			panels[i] = (i - pause - 2) % 10
	print(''.join([str(i) for i in panels]))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n >= 3:
		a = [9, 8, 9]
		for i in range(n - 3):
			a.append(i % 10)
		for i in range(n):
			print(a[i], end='')
		print('\n')


for i in range(int(input())):
	n = int(input())
	s = '989' + int((n - 3) / 10) * '0123456789'
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		for i in range((n - 3) % 10):
			s += str(i)
		print(s)


for _ in range(int(input())):
	n = int(input())
	pref = ['9', '8']
	result = []
	res = [None] * (n + 25)
	for i in range(0, len(res) - 15, 10):
		res[i] = '9'
		res[i + 1] = '0'
		res[i + 2] = '1'
		res[i + 3] = '2'
		res[i + 4] = '3'
		res[i + 5] = '4'
		res[i + 6] = '5'
		res[i + 7] = '6'
		res[i + 8] = '7'
		res[i + 9] = '8'
	res = pref + res
	print(''.join(res[:n]))


s = '989' + '0123456789' * 20000
T = int(input())
for _ in range(T):
	N = int(input())
	print(s[:N])


n = '989' + '0123456789' * 222222
for i in range(int(input())):
	print(n[0:int(input())])


int_line = lambda : list(map(int, input().strip().split()))
int_inp = lambda : int(input())

def uttar(n):
	numbers = '0123456789'
	if n == 1:
		return '9'
	elif n == 2:
		return '98'
	elif n == 3:
		return '989'
	n -= 3
	times = n // 10
	excess = n % 10
	return '989' + numbers * times + numbers[:excess]
try:
	for _ in range(int_inp()):
		n = int_inp()
		print(uttar(n))
except EOFError:
	pass


for w in range(int(input())):
	n = int(input())
	s = '0123456789'
	if n <= 3:
		print('989'[:n])
	else:
		print('989' + s * ((n - 3) // 10) + s[:(n - 3) % 10])


def solution(n):
	s1 = '8901234567'
	if n == 1:
		return 9
	return '9' + (n - 1) // 10 * s1 + s1[:(n - 1) % 10]
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	print(solution(n))


sol = '989' + '0123456789' * 100000
n = int(input())
for i in range(n):
	m = int(input())
	print(sol[:m])


for _ in range(int(input())):
	n = int(input())
	ans = []
	cur = 9
	while len(ans) < n:
		ans.append(cur)
		if len(ans) < 2:
			cur -= 1
		else:
			cur += 1
		cur %= 10
	print(''.join(map(str, ans)))


count = int(input())
for _ in range(count):
	a = int(input())
	list_1 = [str(i) for i in range(10)]
	list_3 = ['9', '8', '9']
	list_2 = []
	if a < 4:
		for i in range(a):
			list_2.append(list_3[i])
		f = ''.join(list_2)
		print(f)
	else:
		a -= 3
		b = a // 10
		c = a - b * 10
		list_2 = list_3 + b * list_1 + [list_1[i] for i in range(c)]
		f = ''.join(list_2)
		print(f)


t = int(input())
for i in range(t):
	n = int(input())
	if n >= 2:
		k = 8
		ans = [9]
		for i in range(n - 1):
			ans.append(k)
			k += 1
			if k == 10:
				k = 0
		print(*ans, sep='')
	else:
		print(9)


for _ in ' ' * int(input()):
	n = int(input())
	s = '0123456789'
	print('989'[:min(n, 3)] + s * max((n - 3) // 10, 0) + s[:max(n - 3, 0) % 10])


from __future__ import division, print_function
from itertools import permutations, combinations
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def string2intlist(s):
	return list(map(int, s))

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def nCr(n, r):
	i = 1
	while i < r:
		n *= n - i
		i += 1
	return n // math.factorial(r)

def LCM(x, y):
	return x * y // math.gcd(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def knapSack(W, wt, val, n):
	K = [[0 for x in range(W + 1)] for x in range(n + 1)]
	for i in range(n + 1):
		for w in range(W + 1):
			if i == 0 or w == 0:
				K[i][w] = 0
			elif wt[i - 1] <= w:
				K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i - 1][w])
			else:
				K[i][w] = K[i - 1][w]
	return K[n][W]

def modularExponentiation(x, n):
	M = 10 ** 9 + 7
	if n == 0:
		return 1
	elif n % 2 == 0:
		return modularExponentiation(x * x % M, n // 2)
	else:
		return x * modularExponentiation(x * x % M, (n - 1) // 2) % M

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
for _ in range(inin()):
	n = inin()
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print(989, end='')
		j = 0
		for i in range(0, n - 3):
			if j == 10:
				j = 0
			print(j, end='')
			j += 1
		print()


for _ in range(int(input())):
	N = int(input())
	S = '9012345678'
	if N == 1:
		print(9)
	elif N == 2:
		print(98)
	else:
		print(98, end='')
		N -= 2
		if N >= 10:
			print(S * (N // 10), end='')
			N %= 10
		print(S[:N])


l = '0123456789'
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print('9')
		continue
	elif n == 2:
		print('98')
		continue
	elif n == 3:
		print('989')
		continue
	else:
		s = '989'
		n -= 3
		j = 0
		while n > 0:
			s += l[j]
			j = (j + 1) % 10
			n -= 1
	print(s)


for s in [*open(0)][1:]:
	n = int(s)
	print(('9' + '8901234567' * n)[:n])


for _ in [0] * int(input()):
	n = int(input())
	(a, b) = ('989', '0123456789')
	if n < 4:
		print(a[:n])
	if n > 3:
		print(a + b * ((n - 3) // 10) + b[:(n - 3) % 10])


t = int(input())
while t:
	t -= 1
	n = int(input())
	str1 = '989'
	str2 = '0123456789'
	if n < 4:
		ans = str1[:n]
	else:
		ans = str1
		n -= 3
		ans += str2 * (n // 10)
		ans += str2[:n % 10]
	print(ans)


s = '9890' + '1234567890' * 69696
for _ in range(int(input()) if True else 1):
	n = int(input())
	print(s[:n])


for _ in range(int(input())):
	n = int(input())
	s = '989'
	x = '0123456789'
	if n <= 3:
		print(s[:n])
	else:
		n -= 3
		print(s + x * (n // 10) + x[:n % 10])


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	result = '989' + '0123456789' * ceil(n / 10)
	print(result[:n])


times = int(input())
for _ in range(times):
	length = int(input())
	string = 9
	print(9, end='')
	if length > 1:
		print(8, end='')
	i = 2
	while i < length:
		i += 1
		print(string, end='')
		string += 1
		string = 0 if string == 10 else string
	print()


for _ in range(int(input())):
	n = int(input())
	if n > 2:
		ans = [9, 8]
		for i in range(2, n):
			ans.append((8 + (i - 1)) % 10)
		print(''.join(map(str, ans)))
	elif n == 2:
		print('98')
	else:
		print('9')


t = int(input())
b = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(t):
	s = '989'
	n = int(input())
	if n < 4:
		print(s[:n])
	else:
		for i in range(n - 3):
			s += str(b[i % len(b)])
		print(s)


t = int(input())
l = []
m = 0
s1 = '9890123456789'
s2 = '0123456789'
for i in range(t):
	n = int(input())
	if n == 0:
		print(0)
	elif n <= 13:
		print(s1[0:n])
	else:
		x = n - 3
		y = x // 10
		r = x % 10
		stri = '989' + y * s2 + s2[0:r]
		print(stri)


t = int(input())

def result(n):
	l = []
	for i in range(n):
		l.append((8 + abs(1 - i)) % 10)
	return l
for i in range(t):
	n = int(input())
	l = result(n)
	for i in l:
		print(i, end='')
	print('\n')


s = '989'
for _ in range(int(input())):
	n = int(input())
	a = 0
	while a < n:
		s = s + '0123456789'
		a = a + 10
	print(s[:n])


t = int(input())
while t > 0:
	n = int(input())
	st = '9' + '8901234567' * n
	print(st[:n])
	t -= 1


for ___ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	else:
		a = '98'
		x = '9012345678'
		n = max(n - 2, 0)
		a += x * (n // 10)
		for i in range(n % 10):
			a += x[i]
		print(a)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	else:
		print('98', end='')
		ans = 8
		c = 3
		while c != n + 1:
			ans = (ans + 1) % 10
			print(ans, end='')
			c += 1
		print()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n == 1:
		ans.append('9')
	elif n == 2:
		ans.append('98')
	else:
		ans.append('989' + '0123456789' * ((n - 3) // 10) + '0123456789'[:n % 10 - 3])
print(*ans, sep='\n')


s = '989'
r = '0123456789'
t = int(input())
for _ in range(t):
	n = int(input())
	print((s + r * (n // 10 + 2))[:n])


def digitalPanel(number):
	rightString = '0123456789'
	leftString = '989'
	x = number - 3
	if number == 1:
		return '9'
	elif number == 2:
		return '98'
	elif number == 3:
		return '989'
	for i in range(x // 10):
		leftString += rightString
	leftString += rightString[:x % 10]
	return leftString
testCases = int(input())
for t in range(testCases):
	number = int(input())
	print(digitalPanel(number))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	mau = '8901234567'
	print('9' + mau * ((n - 1) // 10) + mau[:(n - 1) % 10])


a = '989' + '0123456789' * 20000
for x in range(int(input())):
	n = int(input())
	print(a[:n])


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		ans = '9890'
		c = 1
		for i in range(n - 4):
			ans += str(c % 10)
			c += 1
		print(ans)


def fun(n):
	if n == 1:
		return 9
	if n == 2:
		return 98
	if n == 3:
		return 989
	p = '0123456789'
	return str(989) + p * ((n - 3) // 10) + p[:(n - 3) % 10]
for _ in range(int(input())):
	print(fun(int(input())))


import sys

def solve(n):
	r = '98'
	while len(r) < n:
		r = r + '9012345678'
	return r[:n]
t = int(input())
for case in range(t):
	n = int(input())
	print(solve(n))


import sys
t = int(sys.stdin.readline())
for dummy_case in range(t):
	n = int(sys.stdin.readline())
	num = 9
	i = 0
	while i < n:
		if i == 0:
			sys.stdout.write(str(num % 10))
			num -= 1
		else:
			sys.stdout.write(str(num % 10))
			num += 1
		i += 1
	sys.stdout.write('\n')


for _ in range(int(input())):
	n = int(input())
	s = '989'
	s1 = '0123456789'
	if n > 3:
		x = n - 3
		v = x // 10
		y = x % 10
		r = s + s1 * v + s1[:y]
		print(r)
	else:
		r = s[:n]
		print(r)


t = int(input())
s = '9890123456789'
for i in range(0, t):
	n = int(input())
	s1 = '0123456789'
	if n <= 13:
		print(s[:n])
	else:
		result = s
		n = n - 13
		times = n // 10
		cont = n % 10
		result += s1 * times + s1[:cont]
		print(result)


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
mod = 10 ** 9 + 7
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	fact(x, mod)
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa.reverse()

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def floorsum(a, b, c, n):
	if a == 0:
		return b // c * (n + 1)
	if a >= c or b >= c:
		return floorsum(a % c, b % c, c, n) + b // c * (n + 1) + a // c * n * (n + 1) // 2
	m = (a * n + b) // c
	return n * m - floorsum(c, c - b - 1, a, m - 1)

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] > self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return (flag, prime)

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

def lcm(a, b):
	return a * b // gcd(a, b)

def lis(nums):
	res = []
	for k in nums:
		i = bisect.bisect_left(res, k)
		if i == len(res):
			res.append(k)
		else:
			res[i] = k
	return len(res)

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

def topo(n):
	q = deque()
	res = []
	for i in range(1, n + 1):
		if ind[i] == 0:
			q.append(i)
			res.append(i)
	while q:
		u = q.popleft()
		for v in g[u]:
			ind[v] -= 1
			if ind[v] == 0:
				q.append(v)
				res.append(v)
	return res
t = N()
for i in range(t):
	n = N()
	if n < 3:
		print(9 if n == 1 else 98)
		continue
	cur = 9
	ans = ['9', '8']
	for i in range(n - 2):
		ans.append(str(cur))
		cur += 1
		cur %= 10
	ans = ''.join(ans)
	print(ans)


import sys

def input():
	return sys.stdin.readline()
test_case = int(input())
for _ in range(test_case):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		arr = [9, 8, 9] + [0] * (n - 3)
		ans = '989'
		for i in range(3, n):
			arr[i] = (8 + i - 1) % 10
		print(''.join(map(str, arr)))


import os
from heapq import heapify, heappop, heappush
import sys
import sys, threading
import math
import operator
import bisect
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		if n == 1:
			print(9)
		elif n == 2:
			print(98)
		else:
			ar = [8] * n
			ar[0] = 9
			for i in range(2, n):
				ar[i] += i - 1
				ar[i] %= 10
			for i in ar:
				print(i, end='')
			print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
k = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for _ in range(t):
	n = int(input())
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	elif n == 3:
		print('989')
	else:
		ans = '989'
		n -= 3
		i = 0
		print(ans, end='')
		while n != 0:
			print(k[i % 10], end='')
			n -= 1
			i += 1
	print()


org = '0123456789'
front = '989'
for i in range(int(input())):
	num_panel = int(input())
	if num_panel <= 3:
		print(front[:num_panel])
	else:
		(divisor, remainder) = divmod(num_panel - 3, 10)
		print(front + org * divisor + org[:remainder])


t = int(input())
for i in range(0, t):
	n = int(input())
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	else:
		print('989', end='')
		n = n - 3
		print(n // 10 * '0123456789', end='')
		u = n % 10
		for j in range(0, u):
			print(j, end='')
		print('')


import sys
from functools import reduce
from collections import Counter
import time
import datetime
import math

def ip():
	return int(sys.stdin.readline())

def sip():
	return input()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.insert(i, arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
t = ip()
while t:
	t -= 1
	n = ip()
	print(9, end='')
	val = 8
	for i in range(n - 1):
		print(val, end='')
		val += 1
		if val == 10:
			val = 0
	print()


for run in range(int(input())):
	n = int(input())
	s = '989'
	if n <= 3:
		print(s[:n])
	else:
		st = s
		x = '0123456789'
		m = n - 3
		m = m // 10
		st += x * m
		p = 3 + m * 10
		p = n - p
		st += x[:p]
		print(st)


from io import BytesIO, IOBase
import sys
import math
import os
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def solve():
	n = int(input())
	if n == 1:
		print(9)
		return
	print(98, end='')
	c = 9
	for i in range(n - 2):
		print(end=str(c))
		c = (c + 1) % 10
	print()
	return

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = vary(1)
for _ in range(testcases):
	n = vary(1)
	s = [9, 8, 9]
	if n < 3:
		print(*s[:n], sep='')
		continue
	p = 0
	while n - 3 > 0:
		s.append(p % 10)
		p += 1
		n -= 1
	print(*s, sep='')


t = int(input())
for _ in range(t):
	s = '8901234567'
	n = int(input())
	if n == 1:
		print(9)
	else:
		r = n - 1
		d = r % 10
		l = r // 10
		day = '9' + l * s + s[:d]
		print(day)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007

def A():
	n = int(input())
	list = []
	prelis = [9, 8, 9]
	op = 1
	if n == 1:
		list = [9]
	elif n == 2:
		list = [9, 8]
	else:
		a = 0
		list = prelis
		for i in range(n - 3):
			list.append(a)
			a += 1
			if a == 10 and op == 1:
				a = 0
	for i in list:
		print(i, end='')
	print('\n')

def B():
	print()

def C():
	print()

def main():
	t = int(input())
	while t > 0:
		A()
		t = t - 1
main()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
from itertools import accumulate as ac
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	ans = [None] * n
	if n == 1:
		ans[0] = 9
	else:
		ct = 9
		for i in range(2):
			ans[i] = ct
			ct -= 1
		ct = 9
		for i in range(2, n):
			ans[i] = ct
			ct += 1
			ct %= 10
	ans = [str(i) for i in ans]
	ans = ''.join(ans)
	print(ans)


t = int(input())
x = '989'
y = '0123456789'
for _ in range(t):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		a = 0
		ans = x
		for i in range(3, n):
			ans += str(a)
			a += 1
			if a == 10:
				a = 0
		print(ans)


import sys
numbers = [int(n) for n in sys.stdin.readlines()]

def largest(n):
	if n < 3:
		print(['9', '98', '989'][n - 1])
	else:
		print('989' + '0123456789' * ((n - 3) // 10) + '0123456789'[:(n - 3) % 10])
for n in numbers[1:]:
	largest(n)


import sys
from sys import stdin
import math

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def linput():
	return list(map(int, input().split()))

def fiinput():
	return int(stdin.readline())

def fminput():
	return map(int, stdin.readline().strip().split())

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(iinput()):
	n = iinput()
	print(9, end='')
	x = 8
	for i in range(n - 1):
		print(x, end='')
		x = x + 1
		if x > 9:
			x = 0
	print()


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		ans = [9, 8]
		temp = 9
		while len(ans) < n:
			ans.append(temp)
			temp += 1
			temp %= 10
		for i in range(n):
			print(ans[i], end='')
		print()


import sys
for m in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	Mains = (n - 3) // 10
	Over = (n - 3) % 10
	if Mains < 0:
		Mains = 0
	if n <= 3:
		Over = 0
	running = 0
	Answer = ''
	if n >= 1:
		Answer += '9'
	if n >= 2:
		Answer += '8'
	if n >= 3:
		Answer += '9'
	Answer += '0123456789' * Mains
	for p2 in range(Over):
		Answer += str(running % 10)
		running += 1
	print(Answer)


def soln(n):
	s = '989'
	if n <= 3:
		print(s[0:n])
	else:
		print(s, end='')
		for i in range(3, n):
			print(str((i - 3) % 10), end='')
t = int(input())
j = 1
while j <= t:
	k = int(input())
	soln(k)
	print('\n')
	j += 1


t = int(input())
for i in range(t):
	n = int(input())
	s = '98' + '9012345678' * n
	print(s[:n])


s = '989' + '0123456789' * 100000
t = int(input())
for _ in range(t):
	n = int(input())
	print(s[:n])


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

def geti():
	return map(int, input().strip().split())

def getl():
	return list(map(int, input().strip().split()))

def getis():
	return map(str, input().strip().split())

def getls():
	return list(map(str, input().strip().split()))

def gets():
	return input().strip()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	for _ in range(geta()):
		n = geta()
		if n == 1:
			print(9)
			continue
		if n == 2:
			print(98)
			continue
		res = '989'
		n -= 3
		ans = '0123456789'
		res += ans * (n // 10)
		res += ans[:n % 10]
		print(res)
solve()


t = int(input())
for q in range(t):
	n = int(input())
	number = [0 for x in range(n)]
	if n == 1:
		print(9)
		continue
	elif n == 2:
		print(98)
		continue
	number[1] = 8
	number[0] = 9
	number[2] = 9
	cur = 3
	for x in range(n - 3):
		if number[cur - 1] == 9:
			number[cur] = 0
		else:
			number[cur] = number[cur - 1] + 1
		cur += 1
	for x in number:
		print(x, end='')
	print()


for _ in range(int(input())):
	n = int(input())
	s = '989'
	if n < 4:
		print(s[:n])
	else:
		print(s, end='')
		x = 0
		for i in range(3, n):
			print(x, end='')
			if x == 9:
				x = 0
			else:
				x += 1
	print()


def process():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n == 1:
			print(9)
		elif n == 2:
			print(98)
		elif n == 3:
			print(989)
		else:
			begin = '989'
			period = '0123456789'
			n = n - 3
			print(begin + period * (n // 10) + period[:n % 10])
process()


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	r = '989'
	c = 3
	r += '0123456789' * ((n - c + 9) // 10)
	print(r[:n])


t = int(input())
for _ in range(t):
	n = int(input())
	output = '989'
	output += '0123456789' * n
	print(output[:n])


from math import *
from random import *
for t in range(int(input())):
	n = int(input())
	otv = [0 for j in range(n)]
	otv[0] = 9
	if n > 1:
		otv[1] = 8
	for i in range(2, n):
		otv[i] = (otv[i - 1] + 1) % 10
	for i in otv:
		print(i, end='')
	print()


def func():
	t = int(input())
	num = []
	for _ in range(t):
		num.append(int(input()))
	base = '989' + '0123456789' * (max(num) // 10 + 1)
	for item in num:
		print(base[0:item])
func()


t = int(input())
for x in range(t):
	n = int(input())
	st = '9' + '8901234567' * n
	print(st[:n])


l = '989' + '0123456789' * 23000
for _ in range(int(input())):
	n = int(input())
	print(l[:n])


for _ in range(int(input())):
	n = int(input())
	(s, j) = ('989', 0)
	if n < 4:
		print(s[:n])
	else:
		for i in range(n - 3):
			if j > 9:
				j = 0
			s += str(j)
			j += 1
		print(s)


import math as mt
for _ in range(int(input())):
	n = int(input())
	s = '0123456789'
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	elif n == 3:
		print('989')
	else:
		n -= 3
		print('989' + n // 10 * s + s[:n % 10])


t = int(input())
res = []
for i in range(t):
	n = int(input())
	if n == 1:
		res.append('9')
		continue
	elif n == 2:
		res.append('98')
		continue
	else:
		ress = '989'
		ress += '0123456789' * ((n - 3) // 10)
		for j in range((n - 3) % 10):
			ress += str(j)
		res.append(ress)
for i in range(t):
	print(res[i])


for p in range(int(input())):
	n = int(input())
	s = '0123456789'
	a = '989'
	if n <= 3:
		print(a[:n])
	else:
		n -= 3
		c = n // 10
		d = n % 10
		print(a, end='')
		f = s * c
		print(f, end='')
		print(s[:d])


g = int(input())
for i in range(g):
	f = int(input())
	s = '0123456789' * (f // 10 + f % 10)
	if f == 1:
		print('9')
	elif f == 2:
		print('98')
	elif f == 3:
		print('989')
	else:
		print(f'989{s[0:f - 3]}')


def main():
	tests_cases = 1
	tests_cases = int(input())
	for _ in range(tests_cases):
		n = int(input())
		s = '989'
		s = s + '0123456789' * n
		print(s[:n])
main()


n = int(input())
l1 = []
for i in range(n):
	l1.append(int(input()))
for i in l1:
	a = '9' + '8901234567' * i
	print(a[:i])
print()


for _ in range(int(input())):
	n = int(input())
	stri = '98'
	a = 9
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	else:
		for i in range(n - 2):
			stri += str(a)
			if a == 9:
				a = 0
			else:
				a += 1
		print(stri)


for _ in range(int(input())):
	a = int(input())
	b = (a - 3) // 10
	c = (a - 3) % 10
	y = list('989' + b * '0123456789')
	i = 0
	j = 9
	while i < c:
		y.append(str(i))
		i += 1
	if a <= 3:
		print(''.join(y[:a]))
	else:
		print(''.join(y))


import timeit

def aaa(n):
	if n == 1:
		return 9
	elif n == 2:
		return 98
	else:
		nn = n // 10 + 1
		fr = '9012345678' * nn
		res = '98' + fr[:n - 2]
		return res
cases = int(input())
while cases:
	cases -= 1
	n = int(input())
	print(aaa(n))


null = '989' + '0123456789' * 222222
for i in range(int(input())):
	print(null[0:int(input())])


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print('9')
	elif n == 2:
		print('98')
	elif n == 3:
		print('989')
	else:
		print('989' + '0123456789' * ((n - 3) // 10) + '0123456789'[:(n - 3) % 10])


for _ in range(int(input())):
	n = int(input())
	e = '0123456789'
	f = '989'
	y = f[:n]
	if n <= 3:
		print(y)
	else:
		u = int((n - 3) // 10)
		if u > 0:
			o = y + e * u
			t = o + e[:n - len(o)]
			print(t)
		elif u == 0:
			t = e[:n - 3]
			print(y + t)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
		continue
	else:
		r = '98'
	num = '9012345678'
	num_arr = ['9', '0', '1', '2', '3', '4', '5', '6', '7', '8']
	n = n - 2
	x = n // 10
	y = n % 10
	l = ''.join(num_arr[:y])
	for i in range(x):
		r += num
	r = r + l
	print(r)


for _ in range(int(input())):
	n = int(input())
	m = '0123456789'
	k = '989'
	res = ''
	if n <= 3:
		res = res + k[:n]
	else:
		n = n - 3
		res = res + k
		freq = n // 10
		for x in range(freq):
			res = res + m
		r = n % 10
		res = res + m[0:r]
	print(res)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(9)
	elif n == 2:
		print(98)
	elif n == 3:
		print(989)
	else:
		print(989, end='')
		c = 0
		for i in range(n - 3):
			print(c % 10, end='')
			c += 1
		print()


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
query = []
for i in range(ii1()):
	query.append(ii1())
ma = max(query)
arr = '989'
curr = 0
for i in range(ma + 10):
	arr += str(curr % 10)
	curr += 1
for i in query:
	for j in range(i):
		print(arr[j], end='')
	print()


for _ in range(int(input())):
	n = int(input())
	if n <= 1:
		ans = ''
		for i in range(9, 10 - n - 1, -1):
			ans += str(i)
		print(int(ans))
	else:
		s = '9'
		s1 = '8901234567'
		x = (n - 1) // 10
		y = (n - 1) % 10
		ans = s + s1 * x + s1[:y]
		print(ans)


for _ in range(int(input())):
	n = int(input())
	ch = '0123456789'
	s = '989'
	if n <= 3:
		print(s[:n])
	else:
		c = ch * n
		r = s + c
		print(r[:n])


import sys
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	tmp = ['9', '8', '9']
	if n <= 3:
		tmp = tmp[:n]
		tmp = ''.join(tmp)
	else:
		for i in range(n - 3):
			tmp.append(str(i % 10))
		tmp = ''.join(tmp)
	print(tmp)