#include"bits/stdc++.h"
using namespace std;

#define F first
#define S second
#define pb push_back
#define pf push_front
typedef long long ll;
typedef string ss;
typedef map<ll, ll> ml;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
typedef vector<pl> vp;
//for(int i=0 ; i < n ;i++)

void solve() {
 ll n; cin>> n;

 vl v{0,9,8,9,7,6,5,4,3,2,1,0};

 if(n>3){
    for(int i=1 ; i < 4 ;i++)
    cout<<v[i];
    ll i=0;
    n=n-3;
    while(n--){
        cout<<i;
        i= ++i%10;
    }
    cout<<endl;
   }
   else{

    for(int i=1 ; i <=n ;i++)
    cout<<v[i];
    cout<<endl;
   }
   }
int main() {
    ios::sync_with_stdio(0), cin.tie(0);

    ll t;
    cin >> t;
    while (t--)
        solve();





}
void multiblication_tow_number(ll x,ll y){
   ll z=0;
    while(x>0){
        if(x%2==1){
            z+=y;
        }
        x=x>>1;  //x/=2;
        y=y<<1;  //y*=2;
    }
cout<<z<<endl;
}
