#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    while(tc--)
    {
        int x;
        cin>>x;
        vector<long long>v;
        for(int i=9;i>=1;i--)
        {
            if(x>i)
            {
                x-=i;
                v.push_back(i);
            }
            else
            {
                v.push_back(x);
                x=0;
                break;
            }
        }
        if(x)
            cout<<"-1"<<endl;
        else
        {
            reverse(v.begin(),v.end());
            for(auto x: v)
                cout<<x;
            cout<<endl;
        }
    }

return 0;
}