#include #include #include #include #include #include #include #include #include #include #include #include #define N 100100 #define M 2000100 #define LL long long #define INF 0x3f3f3f3f #define FF(i,a,b) for(int i=a;i<=b;++i) #define RR(i,a,b) for(int i=a;i>=b;--i) #define FJ(i,a,b) for(int i=a;i>1) #define lson rt<<1,l,mid #define rson rt<<1|1,mid+1,r #define zero(x) (((x)>0?(x):-(x)) #define MP make_pair #define SZ size() #define IN freopen("in.txt","r",stdin) #define OUT freopen("out.txt","w",stdout) using namespace std; const int MOD=1000000007; const double PI=acos(-1.0); const double EPS=1e-8; int sgn(double x){return(x>EPS)-(x<-EPS);} int a[N], vis[N], cur[N]; int yue[N]; int n; vectoroc; int isok(int len){ int sz = oc.size(); FF(i, 0, sz-1) { vis[oc[i]] = 0; } FF(i, 1, len) { ++vis[a[i]]; } int p = len+1; //, isok = 1; while(p!=n+1) { FF(i, 0, sz-1) cur[oc[i]] = 0; FF(i, p, p+len-1) { ++cur[a[i]]; } FF(i, 0, sz-1){ if(cur[oc[i]] != vis[oc[i]]) return 0; } p+=len; } return 1; } int main(){ int _;SC(_); FF(ca,1,_){ SC(n); oc.clear();CL(vis,0);CL(yue,0); FF(i, 1, n){ SC(a[i]); if(!vis[a[i]]){ vis[a[i]] = 1; oc.PB(a[i]); } } int to = n-1; FF(i, 1, to) { if(yue[i] || n%i!=0) continue; int ans = isok(i); if(ans==1){ int bei = i; while(n%bei==0 && bei<=n){ yue[bei] = 1; bei += i; } } } FF(i, 1, n-1) if(yue[i]) printf("%d ", i); PR(n); } return 0; }