#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair PII; #define fi first #define se second #define MP make_pair int read() { int v = 0, f = 1; char c = getchar(); while (c < 48 || 57 < c) {if (c == '-') f = -1; c = getchar();} while (48 <= c && c <= 57) v = v * 10 + c - 48, c = getchar(); return v * f; } const int N = 1000000; int n, a[N], ans[N], d[N], c[N], b[N]; void Main() { n = read(); for (int i = 1; i <= n; i++) a[i] = read(); ans[0] = 0; for (int i = 1; i <= n; i++) if (n % i == 0) { for (int k = 1; k <= n; k++) b[k] = 0; for (int k = 1; k <= i; k++) b[a[k]]++; int F = 1; for (int j = 2; j <= n / i; j++) { for (int k = 1; k <= d[0]; k++) c[d[k]] = 0; d[0] = 0; for (int k = (j - 1) * i + 1; k <= j * i; k++) { if (c[a[k]] == 0) d[++d[0]] = a[k]; c[a[k]]++; } int f = 1; for (int k = 1; k <= d[0]; k++) if (b[d[k]] != c[d[k]]) f = 0; if (f == 0) F = 0; } if (F) ans[++ans[0]] = i; } for (int i = 1; i < ans[0]; i++) printf("%d ", ans[i]); printf("%d\n", ans[ans[0]]); } int main() { int T = read(); while (T--) Main(); }