#include<bits/stdc++.h>
using namespace std;
#define lli  long long int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define loopb(i,a,b) for (lli i=a;i>=b;i--)
#define pb push_back
#define mod 1000000007
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define gcd(a,b) (__gcd((a),(b)))
#define lcm(a,b)(((a)*(b))/gcd((a),(b)))
#define bc __builtin_popcountll
#define vi vector<lli>
#define pr pair<lli,lli>
#define vp vector<pr>
#define F  first
#define S   second
#define lld long double
#define PI  3.14159265358979
#define pri  priority_queue<lli>
#define prim  priority_queue<lli,vector<lli>,greater<lli>>
#define prip  priority_queue<pr>
#define primp  priority_queue<pr,vector<pr>,greater<pr>>
#define flush  cout<<flush
 

int main(){
    lli t,n;
    cin>>t;
    while(t--){
        cin>>n;
        lli a[n];
        lli st = 9;
        a[0] = 9;
        loop(i,1,3){
            if( i  > (n-1)){
                break;
            }
            else{
                if(i==1)a[i] = 8;
                if(i==2)a[i] = 9;
            }
        }
        st = 0;
        loop(i,3,n){
            a[i] = st;
            st = st + 1;
            if(st == 10)st = 0;
           

        }
        loop(i,0,n){
            cout<<a[i];
        }
        cout<<"\n";
    }
}