#include #include #include #include #include #include #define LL long long #define xx first #define yy second #define pii pair #define ls rt << 1 #define rs rt << 1 | 1 #define lson ls, l, m #define rson rs, m + 1, r using namespace std; const int N = 100010, INF = 0x3f3f3f3f; int a[N], c[N], c2[N], t[N], ok[N]; int n, cnt; bool jug (int x) { ++cnt; for (int i = 1; i <= x; i++) { c[a[i]] = 0; t[a[i]] = cnt; } for (int i = 1; i <= x; i++) { c[a[i]]++; } for (int i = 2; i <= n / x; i++) { int l = x * (i - 1) + 1, r = l + x - 1; for (int j = 1; j <= x; j++) { c2[a[j]] = 0; } for (int j = l; j <= r; j++) { if (t[a[i]] != cnt) return 0; if (++c2[a[j]] > c[a[j]]) return 0; } } return 1; } int main () { // freopen ("in.txt", "r", stdin); int T; cin >> T; while (T--) { cin >> n; for (int i = 1; i <= n; i++) { scanf ("%d", &a[i]); } memset (ok, 0, sizeof ok); for (int i = 1; i <= n; i++) if (n % i == 0 && !ok[i]) { if (jug (i)) { for (int j = i; j <= n; j += i) if (n % j == 0) ok[j] = 1; } } int flag = 0; for (int i = 1; i <= n; i++) if (ok[i]) { if (flag) printf (" "); flag = 1; printf ("%d", i); } printf ("\n"); } }