/*
       shool : Cu Chi High School
       participant : Ngo Quoc Binh
*/
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cerr << #x << " = " << x << "\n";
#define vdebug(a) cerr << #a << " = "; for(auto x : a) cout << x << " "; cout << "\n";
#define TIME cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define hashmap unordered_map
#define hashset unordered_set
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rev(x) reverse(all(x))
#define sz(x) ((int)((x).size()))
#define max_arr(x) *max_element(all(x))
#define min_arr(x) *min_element(all(x))

#define pb push_back
#define pf push_front
#define PB pop_back
#define PF pop_front
#define en '\n'
#define ff first
#define ss second
#define task "wtf"

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u128 = __uint128_t;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ull mul_mod(ull a, ull b, ull mod)
{
        return (u128)a * b % mod;
}

ull pow_mod(ull a, ull d, ull mod)
{
        ull res = 1;
        while(d)
        {
                if(d & 1) res = mul_mod(res, a, mod);
                a = mul_mod(a, a, mod);
                d >>= 1;
        }
        return res;
}

bool isPrime(ull n)
{
        if(n < 2) return false;
        for(ull p : {2,3,5,7,11,13,17,19,23,29,31,37})
        {
                if (n % p == 0) return n == p;
        }

        ull d = n - 1, s = 0;
        while((d & 1) == 0)
        {
                d >>= 1;
                s++;
        }

        for(ull a : {2ULL,325ULL,9375ULL,28178ULL,450775ULL,9780504ULL,1795265022ULL})
        {
                if (a % n == 0) continue;
                ull x = pow_mod(a, d, n);
                if (x == 1 || x == n - 1) continue;
                bool ok = false;
                for (ull r = 1; r < s; r++) {
                x = mul_mod(x, x, n);
                if (x == n - 1) {
                        ok = true;
                        break;
                }
                }
                if (!ok) return false;
        }
        return true;
}

ull pollard(ull n) {
    if (n % 2 == 0) return 2;

    while(true)
    {
        ull c = uniform_int_distribution<ull>(1, n - 1)(rng);
        ull x = uniform_int_distribution<ull>(0, n - 1)(rng);
        ull y = x;
        ull d = 1;

        auto f = [&](ull x){return (mul_mod(x, x, n) + c) % n;};

        while(d == 1)
        {
            x = f(x);
            y = f(f(y));
            d = __gcd(x > y ? x - y : y - x, n);
        }

        if(d != n) return d;
    }
}

map<ull,ll> mp;
void factor(ull n)
{
    if(n == 1) return;
    if(isPrime(n))
    {
        mp[n]++;
        return;
    }
    ull d = pollard(n);
    factor(d);
    factor(n / d);
}

vector<pair<ull,ll>> fac;
vector<ull> divi;

void gen(int idx,ull cur)
{
        if(idx == sz(fac))
        {
                divi.pb(cur);
                return;
        }

        ull p = fac[idx].ff,e = fac[idx].ss;
        ull val = 1;
        for(int i = 0 ; i <= e ; i++)
        {
                gen(idx + 1, cur * val);
                val *= p;
        }
}

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

        while(t--)
        {
                ull n;
                cin >> n;

                mp.clear();
                fac.clear();
                divi.clear();
                factor(n);

                for(auto x : mp)
                {
                        fac.pb({x.ff,x.ss});
                }

                gen(0,1);

                sort(all(divi));

                bool ok = false;
                for(ull d : divi)
                {
                        if(d == ULLONG_MAX)  continue;
                        if(d + 1 != 0 && n % (d + 1) == 0)
                        {
                                cout << d << " ";
                                ok = true;
                        }
                }

                if(!ok) cout << -1;
                cout << en;

        }
}

int main()
{
        fastIO

        solve();

        return 0;
}