def solve(): n = int(input()) P = list(map(int, input().split())) ans = [] for i in range(1, n): for j in range(i - 1, -1, -1): if P[j + 1] < P[j]: if P[j + 1] == j + 2 or P[j] == j + 1: print(-1) return ans.append(j + 1) P[j], P[j + 1] = P[j + 1], P[j] print(len(ans)) print(*ans) for _ in range(int(input())): solve()