#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define VEC(n, x) VI n; n.resize(x); rep(i, x) cin >> n[i];
#define MAT(m, x, y) VVI m; m.resize(x); rep(i, x) m[i].resize(y);
#define out(x) cout << (x) << endl;

int main () {
  int N; cin >> N;
  VI x(N), y(N); rep(i, N) cin >> x[i] >> y[i];

  rep(i, N) rep(j, N) rep(k, N) {
    if (i == j || i == k || j == k) continue;

    if ((x[i] == x[j] && x[i] == x[k]) || (y[i] == y[j] && y[i] == y[k])) {
      out("Yes")
      return 0;
    }
    
    double a = (y[j] - y[i]) * (x[k] - x[i]) / (double)(x[j] - x[i]) + y[i];;
    if ((double)y[k] == a) {
      out("Yes")
      return 0;
    }
  }

  out("No");
  return 0;
}
#include<bits/stdc++.h>
using namespace std;

int n; vector<int> ans;

const int MAX=5e2+7;

int s[MAX],p[MAX];

void opt (int pos) {
	swap(p[s[pos]],p[s[pos+1]]);
	swap(s[pos],s[pos+1]);
	ans.push_back(pos);
	return;
}

void solve (int p1,int p2,int p3) {
	while (!(s[p1]<s[p2]&&s[p2]<s[p3])) {
		if (ans.size()%2==p1%2) opt(p2);
		else opt(p1);
	} return;
}

void solve () {
	
	scanf("%d",&n); ans.clear();
	for (int i=1;i<=n;i++)
		scanf("%d",&s[i]),p[s[i]]=i;
	
	if (n==1) { puts("0"); return; }
	if (n==2) {
		if (s[1]>s[2]) puts("1"),puts("1");
		else puts("0");
		return;
	}
	if (n==3) solve(1,2,3);
	
	const int odd=n&1?n-2:n-1;
	const int eve=n&1?n-1:n-2;
	
	for (int i=1;i<=n-3;i++) {
		rst:
		if (p[i]&1) {
			if (ans.size()%2==0)
				{ opt(odd); goto rst; }
			for (int t=p[i]-1;t>=i;t--)
				opt(t);
		} else {
			if (ans.size()%2==1)
				{ opt(eve); goto rst; }
			for (int t=p[i]-1;t>=i;t--)
				opt(t);
		}
	}
	
	solve(n-2,n-1,n);
	
	printf("%d\n",ans.size());
	for (auto cur:ans)
		printf("%d ",cur);
	printf("\n");
	
	return;
		
}

int main () {
	
	int T; scanf("%d",&T);
	while (T--) solve();
	
	return 0;
}