#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
#define ll long long
#define endl '\n'

void fileIO() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

// for (int i = 0; i < n; i++){}

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

    if (n >= 18) cout << -1 << endl;
    else if (n < 10) cout << n << endl;
    else {
        int x = n - 9;
        cout << x << 9 << endl;
    }
}

int main() {
    IOS;
    fileIO();

    int testCases = 1;
    cin >> testCases;
    while (testCases--) {
        solve();
    }
}
