#include <bits/stdc++.h>
// #define int long long
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>
#define sws cin.tie(0)->sync_with_stdio(false);
#define endl '\n'
using namespace std;
const int N = 3e6+10;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-6;
const ld PI = acos(-1);
// #pragma GCC target("popcnt")
// End Template //
vector<int> div(int x) {
vector<int> ans;
for (ll i=1;i*i<=x;i++) {
if (x % i == 0) {
ans.pb(i);
if (i*i != x) ans.pb(x/i);
}
}
sort(ans.begin(), ans.end());
return ans;
}
int32_t main()
{sws;
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<ll> a(n), f(31, 0);
for (int i=0;i<n;i++) {
cin >> a[i];
for (int j=0;j<=30;j++) {
f[j] += !!(a[i] & (1LL << j));
}
}
int g = -1;
for (int j=0;j<=30;j++) {
if (f[j] == 0) continue;
if (g == -1) g = f[j];
g = gcd(g, f[j]);
}
if (g == -1) {
for (int i=1;i<=n;i++) {
cout << i << " ";
}
cout << endl;
} else {
vector<int> d = div(g);
for (auto di: d) {
cout << di << " ";
}
cout << endl;
}
}
return 0;
}
1277A - Happy Birthday Polycarp | 577A - Multiplication Table |
817C - Really Big Numbers | 1355A - Sequence with Digits |
977B - Two-gram | 993A - Two Squares |
1659D - Reverse Sort Sum | 1659A - Red Versus Blue |
1659B - Bit Flipping | 1480B - The Great Hero |
1519B - The Cake Is a Lie | 1659C - Line Empire |
515A - Drazil and Date | 1084B - Kvass and the Fair Nut |
1101A - Minimum Integer | 985D - Sand Fortress |
1279A - New Year Garland | 1279B - Verse For Santa |
202A - LLPS | 978A - Remove Duplicates |
1304A - Two Rabbits | 225A - Dice Tower |
1660D - Maximum Product Strikes Back | 1513A - Array and Peaks |
1251B - Binary Palindromes | 768B - Code For 1 |
363B - Fence | 991B - Getting an A |
246A - Buggy Sorting | 884A - Book Reading |