#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, m, w[N], f[N];
bool fl[N];
inline int read() {
  int num = 0;
  char t = '+', g = getchar();
  while (g < 48 || 57 < g) t = g, g = getchar();
  while (47 < g && g < 58) num = num * 10 + g - 48, g = getchar();
  if (t == '-') return -num;
  return num;
}
int main() {
  int t = read();
  while (t--) {
    n = read(), m = 0;
    for (int i = 1; i <= n; i++) w[i] = i - read(), fl[i] = 0;
    int u = 1;
    while (!fl[u]) fl[u] = 1, u = w[u];
    for (int i = 1; i <= n; i++) fl[i] = 0;
    while (!fl[u]) fl[u] = 1, u = w[u], ++m;
    printf("%d\n", m);
    for (int i = 1; i <= n; i++)
      if (fl[i]) printf("%d ", i);
    putchar('\n');
  }
}
