#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        string ans;
        if(n==1){
            cout<<9<<endl;
        }
        else if(n==2){
            cout<<98<<endl;
        }
        else if(n==3){
            cout<<989<<endl;
        }
        else{
            string ans="989";
            n-=3;
            ll cnt=0;
            while(n){
                ans+=to_string(cnt);
                cnt++;
                cnt%=10;
                n--;
            }
            cout<<ans<<endl;
        }
    }
}
