#include <iostream>
using namespace std;

int cnt[111];
bool check(long long n, int k) {
    for(int i = 0; i < k; ++i)
        cnt[i] = 0;

    long long u = n;
    while (u) {
        cnt[u % 10]++;
        u /= 10;
    }

    for(int pos = k-1; pos >= 0; --pos)
        if (cnt[pos] != n % 10) return false;
        else n /= 10;
    return true;
}

int main() {
    int ntest; cin >> ntest;
    while (ntest--) {
        int k; cin >> k;
        long long lb = 1; for(int turn = 0; turn < k-1; ++turn) lb *= 10;
        long long ub = 1; for(int turn = 0; turn < k; ++turn) ub *= 10; --ub;

        bool ok = false;
        for(long long x = lb; x <= ub; ++x) {
            if (check(x, k)) {
                ok = true;
                cout << x << ' ';
            }
        }
        if (!ok) cout << -1 << endl;
        else cout << endl;
    }
}
