Read problems statements in Mandarin Chinese  and Russian. 

You are given a multiset of N integers. Please find such a nonempty subset of it that the sum of the subset's elements is divisible by N. Otherwise, state that this subset doesn't exist.

------ Input ------ 

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. 

The first line of each test consists of a single integer N - the size of the multiset.

The second line of each test contains N single space separated integers - the multiset's elements.

------ Output ------ 

For each test case output:

-1 if the required subset doesn't exist
If the required subset exists, output two lines. Output the size of the subset on the first line and output the list of indices of the multiset's element that form the required subset. Of course, any number can be taken in the subset no more than once.

If there are several such subsets, you can output any.

------ Constraints ------ 

$1 ≤ The sum of N over all the test cases ≤ 10^{5}$
$Each element of the multiset is a positive integer, not exceeding 10^{9}.$
$1 ≤ N ≤ 15 : 37 points. $
$1 ≤ N ≤ 1000 : 24 points.$
$1 ≤ N ≤ 10^{5} : 39 points. $

------ Example ------ 

Input:
1
3
4 6 10

Output:
1
2

------ Explanation ------ 

We can pick {6} as the subset, then its sum is 6 and this is divisible by 3 - the size of the initial multiset.

Difficulty: VERY_HARD
Tags: Mathematics

Range queries
Skill types: Range queries

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	N = int(input())
	array = list(map(int, input().split()))
	sumx = 0
	sumxIndex = {}
	for i in range(0, N):
		sumx = (sumx + array[i]) % N
		if sumx == 0:
			left = 0
			right = i
			break
		if sumx in sumxIndex.keys():
			left = sumxIndex[sumx] + 1
			right = i
			break
		sumxIndex[sumx] = i
	print(right - left + 1)
	for index in range(left, right + 1):
		print(index + 1, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	sm = 0
	mp = {0: 0}
	for i in range(n):
		sm += arr[i]
		r = sm % n
		if r in mp:
			print(i - mp[r] + 1)
			print(*range(mp[r] + 1, i + 1 + 1), sep=' ')
			break
		else:
			mp[r] = i + 1
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = {}
	s = 0
	for i in range(n):
		s = (s + a[i]) % n
		if s % n == 0:
			print(i + 1)
			for j in range(1, i + 2):
				print(j, end=' ')
			print()
			break
		elif s in b:
			print(i - b[s])
			for j in range(b[s] + 2, i + 2):
				print(j, end=' ')
			print()
			break
		else:
			b[s] = i


import sys
P = [0] * 100010
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	(p1, p2) = (0, 0)
	P[0] = 1
	S = 0
	for i in range(1, n + 1):
		S += arr[i - 1]
		if P[S % n]:
			p1 = P[S % n]
			p2 = i + 1
		P[S % n] = i + 1
	if not p2:
		print(-1)
	else:
		print(p2 - p1)
		print(*[i for i in range(p1, p2)])
	for i in range(1, n + 1):
		P[i] = 0


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	mapper = {}
	for i in range(len(a)):
		res = (res + a[i]) % n
		if res % n == 0:
			print(i + 1)
			for j in range(1, i + 2):
				print(j, end=' ')
			print()
			break
		elif res in mapper:
			print(i - mapper[res])
			for j in range(mapper[res] + 2, i + 2):
				print(j, end=' ')
			print()
			break
		else:
			mapper[res] = i


from numpy import ma
T = int(input())

def solve(N: int, input_set: list):
	compounded = []
	curr_sum = 0
	for (i, x) in enumerate(input_set):
		curr_sum = (curr_sum + x) % N
		if curr_sum == 0:
			print(i + 1)
			print(' '.join(map(str, range(1, i + 2))))
			return
		compounded.append((curr_sum, i + 1))
	compounded = sorted(compounded)
	prev_x = -1
	prev_y = None
	for (x, y) in compounded:
		if x == prev_x:
			print(y - prev_y)
			print(' '.join(map(str, range(prev_y + 1, y + 1))))
			return
		prev_x = x
		prev_y = y
	raise ValueError('Did not find matching moduli')
for _ in range(T):
	N = int(input())
	input_set = [int(x) for x in input().split()]
	solve(N, input_set)


for T in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	mem = [-1 for i in range(n)]
	mod = [0] * (n + 1)
	sum = 0
	mem[0] = 0
	for i in range(1, n + 1):
		sum += arr[i - 1]
		sum %= n
		if mem[sum] == -1:
			mem[sum] = i
		else:
			print(i - mem[sum])
			for j in range(mem[sum], i):
				print(j + 1, end=' ')
			print('\n')
			break


for _ in range(int(input())):
	(n, s, d) = (int(input()), 0, {})
	for (i, j) in enumerate(map(int, input().split())):
		s = (s + j) % n
		if s == 0:
			print(i + 1)
			print(*range(1, i + 2))
			break
		elif s in d:
			print(i - d[s])
			print(*range(d[s] + 2, i + 2))
			break
		d[s] = i


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	s = 0
	ans = {}
	f = 1
	for i in range(n):
		s += ar[i]
		p = s % n
		if p == 0:
			print(i + 1)
			for j in range(1, i + 2):
				print(j, end=' ')
			print()
			break
		elif p not in ans:
			ans[p] = i
		else:
			print(i - ans[p])
			for j in range(ans[p] + 2, i + 2):
				print(j, end=' ')
			print()
			f = 0
			break


def find(n, arr):
	s = [None] * (n + 1)
	s[0] = 0
	su = 0
	for i in range(1, n + 1):
		su = (su + arr[i - 1]) % n
		if s[su] is not None:
			print(i - s[su])
			print(' '.join((str(j + 1) for j in range(s[su], i))))
			return 0
		else:
			s[su] = i
	print(-1)
for _ in range(int(input())):
	find(int(input()), list(map(int, input().split())))


for t in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	store = {0: 0}
	s = 0
	for i in range(n):
		s = (s + a[i]) % n
		if s in store:
			ans = range(store[s] + 1, i + 2)
			break
		store[s] = i + 1
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(n):
		if i == 0:
			b.append(a[i] % n)
		else:
			b.append((b[-1] + a[i]) % n)
	d = {}
	for (idx, i) in enumerate(b):
		if i == 0:
			res = list(range(1, idx + 2))
			print(len(res))
			print(*res)
			break
		if i not in d:
			d[i] = idx
		else:
			res = list(range(d[i] + 2, idx + 2))
			print(len(res))
			print(*res)
			break


import sys
data = sys.stdin.read().split()
data.reverse()

def read():
	return int(data.pop())

def readStr():
	return data.pop()
T = read()
for test in range(T):
	n = read()
	A = [0] + [read() for i in range(n)]
	F = [0] + [-1 for i in range(n - 1)]
	for i in range(1, n + 1):
		A[i] = (A[i - 1] + A[i]) % n
		if F[A[i]] == -1:
			F[A[i]] = i
		else:
			ans = [str(j) for j in range(F[A[i]] + 1, i + 1)]
			break
	print(len(ans))
	print('\n'.join(ans))


from math import ceil, sqrt, log, gcd
from collections import deque, defaultdict as dd
from os import path
import sys
t = int(input())
for f in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	d[0] = 0
	s = 0
	for i in range(1, n + 1):
		s += a[i - 1]
		if s % n not in d:
			d[s % n] = i
		else:
			print(i - d[s % n])
			for j in range(d[s % n], i):
				print(j + 1, end=' ')
			print('')
			break


test = int(input())
for i in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	d = dict()
	d[0] = [0]
	s = 0
	for i in range(n):
		s = (s + arr[i]) % n
		if not d.get(s, False):
			d[s] = [i + 1]
		else:
			start = d[s][0]
			end = i + 1
			print(end - start)
			print(*list(range(start + 1, end + 1)))
			break
	else:
		print(-1)


from sys import stdin
t = int(stdin.readline())
for case in range(t):
	flag = 0
	n = int(stdin.readline())
	n_arr = [int(x) for x in stdin.readline().split()]
	n_sum = [-1 for x in range(n)]
	n_rem = [-1 for x in range(n)]
	n_rem_arr = [-1 for x in range(n)]
	n_sum[0] = n_arr[0]
	n_rem[0] = n_arr[0] % n
	for i in range(1, n):
		n_sum[i] = n_sum[i - 1] + n_arr[i]
		n_rem[i] = n_sum[i] % n
	diff_rl = 1000000
	if n == 1:
		print(1)
		print(0)
		continue
	for i in range(n):
		if n_arr[i] % n == 0:
			print(1)
			print(i + 1)
			flag = 1
			break
	if flag == 1:
		continue
	for i in range(n):
		if n_rem[i] == 0:
			min_r = i
			min_l = 0
			diff_rl = min_r - min_l + 1
			break
	for i in range(n):
		temp = n_rem[i]
		if n_rem_arr[temp] == -1:
			n_rem_arr[temp] = i
		elif i - n_rem_arr[temp] < diff_rl:
			min_r = i
			min_l = n_rem_arr[temp]
			diff_rl = min_r - min_l
			min_l += 1
			n_rem_arr[temp] = i
	print(diff_rl)
	for i in range(min_l, min_r + 1):
		print(i + 1, end=' ')
	print()


t = int(input())
import collections
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	d = {}
	for i in range(n):
		s = (s + a[i]) % n
		if s == 0:
			print(i + 1)
			for j in range(i):
				print(j + 1, end=' ')
			print(i + 1)
			break
		elif s in d:
			print(i - d[s])
			for j in range(d[s] + 1, i):
				print(j + 1, end=' ')
			print(i + 1)
			break
		else:
			d[s] = i


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	ps = 0
	L = []
	d = {}
	c = 0
	for i in range(n):
		ps += l[i]
		if ps % n == 0:
			print(i + 1)
			ans = range(1, i + 2)
			c = 1
			break
		try:
			m = d[ps % n][0]
			print(i + 1 - (m + 1))
			ans = range(m + 2, i + 2)
			c = 1
			break
		except:
			d[ps % n] = [i]
	a = map(str, ans)
	print(' '.join(a))


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	freq = {}
	acc = 0
	(l, r) = (-1, -1)
	for i in range(n):
		acc += arr[i]
		acc %= n
		if acc == 0:
			(l, r) = (1, i + 1)
			break
		elif acc in freq:
			(l, r) = (freq[acc] + 1, i + 1)
			break
		freq[acc] = i + 1
	print(r - l + 1)
	for i in range(l, r + 1):
		print(i, end=' ')
	print()
for t in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().strip().split()]
	curr = 0
	d = {}
	for i in range(n):
		curr += l[i]
		t = curr % n
		if t == 0:
			print(i + 1)
			print(*[j for j in range(1, i + 2)])
			break
		elif t in d:
			st = d[t]
			le = i - st
			print(le)
			print(*[j for j in range(st + 2, st + le + 2)])
			break
		else:
			d[t] = i


import sys
from collections import Counter
import numpy as np
import math
test = False
T = int(input().strip())
for i in range(T):
	N = int(input().strip())
	A = list(map(int, input().strip().split(' ')))
	B = [0]
	for j in range(N):
		B.append((B[-1] + A[j]) % N)
	if test:
		print('B = ', B)
	C = Counter(B)
	if test:
		print('C = ', C)
	D = sorted(C.items(), key=lambda x: x[1], reverse=True)
	if test:
		print('D = ', D)
	common = D[0][0]
	if test:
		print('common = ', common)
	start = B.index(common) + 1
	end = B[start:].index(common) + start
	if test:
		print('start, end = ', start, end)
	answer1 = end - start + 1
	answer2 = ' '.join([str(x) for x in range(start, end + 1)])
	print(answer1)
	print(answer2)
	if test:
		print(' ')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	d = {}
	for i in range(n):
		s = (s + l[i]) % n
		if s == 0:
			print(i + 1)
			for j in range(i):
				print(j + 1, end=' ')
			print(i + 1)
			break
		elif s in d:
			print(i - d[s])
			for j in range(d[s] + 1, i):
				print(j + 1, end=' ')
			print(i + 1)
			break
		else:
			d[s] = i


t = int(input())
for case in range(t):
	n = int(input())
	nos = [int(x) for x in input().split()]
	copy = nos[:]
	nos[0] = copy[0] % n
	if nos[0] == 0:
		print(1)
		print(1)
		continue
	flag = 0
	for i in range(1, n):
		nos[i] = nos[i - 1] + copy[i]
		nos[i] = nos[i] % n
		if nos[i] == 0:
			print(i + 1)
			print(*[x + 1 for x in range(i + 1)])
			flag = 1
			break
	if flag == 1:
		continue
	flag = 0
	index = [x for x in range(n)]
	temp = [x for (_, x) in sorted(zip(nos, index))]
	for i in range(n - 1):
		if nos[temp[i]] == nos[temp[i + 1]]:
			a = min(temp[i + 1], temp[i])
			b = max(temp[i + 1], temp[i])
			print(b - a)
			print(*[x + 1 for x in range(a + 1, b + 1)])
			break


try:

	def find():
		n = int(input())
		dictk = {0: -1}
		sumk = 0
		nums = list(map(int, input().split()))
		for i in range(n):
			k = nums[i]
			if k % n == 0:
				print(1)
				print(i + 1)
				return
			sumk = (sumk + k) % n
			if sumk in dictk:
				print(i - dictk[sumk])
				print(*list(range(dictk[sumk] + 2, i + 2)))
				return
			dictk[sumk] = i
	t = int(input())
	for _ in range(t):
		find()
except:
	pass


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	prefix = [0] * (len(arr) + 1)
	for (i, ele) in enumerate(arr):
		prefix[i + 1] = prefix[i] + ele
	mod_arr = [0] * (n + 1)
	mod_loc = {}
	for (i, ele) in enumerate(prefix):
		mod_arr[i] = prefix[i] % n
		if mod_arr[i] in mod_loc.keys():
			diff = i - mod_loc[mod_arr[i]]
			print(diff)
			for counter in range(mod_loc[mod_arr[i]] + 1, i + 1, 1):
				print(counter, end=' ')
			print()
			break
		else:
			mod_loc[mod_arr[i]] = i


from collections import defaultdict

def printlist(key, l, h):
	if key == 0:
		for i in range(l, h + 1):
			print(i + 1, end=' ')
	else:
		for i in range(l + 1, h + 1):
			print(i + 1, end=' ')
t = int(input())
while t > 0:
	n = int(input())
	x = [int(i) for i in input().split()]
	dit = defaultdict(list)
	sum_ = 0
	for i in range(n):
		sum_ += x[i]
		sum_ = sum_ % n
		dit[sum_] += [i]
	for (k, v) in dit.items():
		if k == 0:
			print(v[0] + 1)
			printlist(k, 0, v[0])
			break
		elif k != 0 and len(v) > 1:
			print(v[1] - v[0])
			printlist(k, v[0], v[1])
			break
	t -= 1


def sol():
	n = int(input())
	a = list(map(int, input().split()))
	pre = [0] * n
	pre[0] = a[0]
	for i in range(1, n):
		pre[i] = pre[i - 1] + a[i]
	a = [i % n for i in pre]
	hsh = {}
	ans = []
	ans1 = []
	for i in range(n):
		if a[i] == 0:
			for j in range(i + 1):
				ans1.append(j + 1)
			break
		elif hsh.get(a[i]) == None:
			hsh[a[i]] = i
		elif hsh.get(a[i]) != None:
			for k in range(hsh[a[i]] + 1, i + 1):
				ans.append(k + 1)
			break
	if ans:
		print(len(ans))
		print(*ans)
	else:
		print(len(ans1))
		print(*ans1)

def main():
	for _ in range(int(input())):
		sol()
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	s = 0
	d[0] = 0
	f = 0
	for i in range(1, n + 1):
		s += a[i - 1]
		s = s % n
		if s not in d:
			d[s] = i
		else:
			f = 1
			print(i - d[s])
			for j in range(d[s], i):
				print(j + 1, end=' ')
			print()
			break
	if f == 0:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	_map = {0: 0}
	_sum = 0
	for i in range(len(arr)):
		_sum += arr[i]
		r = _sum % n
		if r in _map:
			print(i - _map[r] + 1)
			print(*range(_map[r] + 1, i + 1 + 1), sep=' ')
			break
		else:
			_map[r] = i + 1
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	seen = [-1] * (n + 1)
	sm = 0
	f = 0
	seen[0] = 0
	for i in range(1, n + 1):
		sm += l[i - 1]
		sm = sm % n
		if seen[sm] == -1:
			seen[sm] = i
		else:
			f = 1
			print(i - seen[sm])
			for j in range(seen[sm], i):
				print(j + 1, end=' ')
			print()
			break


for i in range(int(input())):
	n = int(input())
	arr = [int(k) for k in input().split()]
	mem = [-1 for j in range(n)]
	mem[0] = 0
	sum = 0
	for l in range(1, n + 1):
		sum = sum + arr[l - 1]
		sum %= n
		if mem[sum] == -1:
			mem[sum] = l
		else:
			print(l - mem[sum])
			for m in range(mem[sum], l):
				print(m + 1, end=' ')
			print('\n')
			break


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().strip().split(' ')))
	N = len(A)
	B = [i + 1 for i in range(len(A))]
	red = [0 for i in range(len(A))]
	post = {}
	temp = 0
	L = 0
	R = N - 1
	for i in range(len(A)):
		temp += A[i]
		temp %= N
		if temp == 0:
			L = 0
			R = i
			break
		if red[temp] == 0:
			post[temp] = i
			red[temp] = 1
		else:
			L = post[temp] + 1
			R = i
			break
	num = R - L + 1
	print(num)
	print(*B[L:R + 1])


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	ids = [-1 for x in range(0, n, 1)]
	sum = 0
	exit = False
	for i in range(len(array)):
		sum = sum + array[i]
		r = sum % n
		if r == 0:
			print(i + 1)
			l = [x + 1 for x in range(i, -1, -1)]
			print(*l)
			exit = True
			break
		elif ids[r] != -1:
			print(i - ids[r])
			l = [x + 1 for x in range(i, ids[r], -1)]
			print(*reversed(l))
			exit = True
			break
		ids[r] = i
	if exit == False:
		print(-1)


import sys

def find(arr, n):
	s = [None] * (n + 1)
	s[0] = 0
	su = 0
	for i in range(1, n + 1):
		su = (su + arr[i - 1]) % n
		if s[su] is not None:
			print(i - s[su])
			for j in range(s[su], i):
				sys.stdout.write(str(j + 1) + ' ')
			sys.stdout.write('\n')
			return 0
		else:
			s[su] = i
	print(-1)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	find(arr, n)


t = int(input())
for i in range(t):
	n = int(input())
	list = [int(x) for x in input().split()]
	pre = 0
	r = 0
	l = 1
	from collections import defaultdict
	hash = dict()
	for i in range(n):
		pre = int(pre + list[i]) % n
		if pre == 0:
			r = i
			l = -1
			break
		elif pre in hash:
			r = i
			l = hash[pre]
			break
		else:
			hash[pre] = i
	print(r - l)
	for k in range(l + 1, r + 1):
		print(k + 1, end=' ')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	cumm_sum = []
	curr_sum = 0
	for i in a:
		curr_sum += i
		cumm_sum.append((curr_sum + n) % n)
	index_arr = [[] for i in range(n)]
	for i in range(n):
		index_arr[cumm_sum[i]].append(i)
	if len(index_arr[0]) >= 1:
		print(index_arr[0][0] + 1)
		for i in range(index_arr[0][0] + 1):
			print(i + 1, end=' ')
	else:
		for i in range(1, n):
			if len(index_arr[i]) > 1:
				st_idx = index_arr[i][0]
				end_idx = index_arr[i][1]
				size = end_idx - st_idx
				print(size)
				for j in range(st_idx + 1, end_idx + 1):
					print(j + 1, end=' ')
				break
	print()


for i in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	freq = [0] * (n + 1)
	summ = 0
	dic = {0: 1}
	for i in range(n):
		summ += arr[i]
		mod = summ % n
		freq[i + 1] = mod
		if mod in dic:
			dic[mod] += 1
		else:
			dic[mod] = 1
	if sum(dic.values()) == n:
		print(-1)
	else:
		ans = []
		key = -1
		for i in dic:
			if dic[i] > 1:
				key = i
				break
		count = 0
		for i in range(n + 1):
			if count == 2:
				break
			elif freq[i] == key and count == 0:
				count += 1
			elif count == 1:
				ans.append(i)
				if freq[i] == key:
					count += 1
					break
		print(len(ans))
		print(*ans)


from collections import Counter, defaultdict

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		d = defaultdict(lambda : [])
		l = [a[0]]
		for i in range(1, n):
			l.append(l[-1] + a[i])
		for i in range(n):
			l[i] %= n
			d[l[i]].append(i)
		for i in d:
			if i == 0:
				print(d[i][0] + 1)
				print(*list(range(1, d[i][0] + 2)))
				break
			if len(d[i]) > 1:
				print(d[i][1] - d[i][0])
				print(*list(range(d[i][0] + 2, d[i][1] + 2)))
				break
main()


def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		if arr[0] % n == 0:
			print(1)
			print(1)
			continue
		freq = []
		for j in range(n):
			freq.append([])
			freq[j].append(0)
		freq[0][0] = 1
		freq[0].append(-1)
		cum_sum = 0
		for j in range(n):
			cum_sum = (cum_sum + arr[j] % n) % n
			freq[cum_sum][0] += 1
			freq[cum_sum].append(j)
		for j in range(len(freq)):
			if freq[j][0] >= 2:
				print(freq[j][2] - freq[j][1])
				for k in range(freq[j][1] + 1, freq[j][2] + 1):
					print(k + 1, end=' ')
				break
solve()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	dd = dict()
	dd[0] = 0
	s = 0
	for i in range(1, n + 1):
		s += arr[i - 1]
		s %= n
		if s not in dd:
			dd[s] = i
		else:
			print(i - dd[s])
			for j in range(dd[s], i):
				print(j + 1, end=' ')
			print('')
			break


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	d[0] = 0
	s = 0
	for i in range(1, n + 1):
		s += a[i - 1]
		s %= n
		if s not in d:
			d[s] = i
		else:
			print(i - d[s])
			for j in range(d[s], i):
				print(j + 1, end=' ')
			print()
			break
	t -= 1


def getModulo(a, n):
	if a < 0:
		return -a % n
	else:
		return a % n
for _ in range(int(input())):
	n = int(input())
	arr = [int(c) for c in input().split()]
	p = []
	s = 0
	for i in arr:
		s += i
		p.append(getModulo(s, n))
	dic = {0: -1}
	for i in range(len(p)):
		if p[i] not in dic:
			dic[p[i]] = i
		else:
			ans = range(dic[p[i]] + 1, i + 1)
			break
	print(len(ans))
	print(*[i + 1 for i in ans])