#include <bits/stdc++.h>
using namespace std;
long long int c = 0;
long long int ans = 0;
vector<vector<long long int> > grap(300100);
vector<long long int> vis(300100, 0);
unordered_map<long long int, long long int> mpp;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
long long int fexp(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    b /= 2;
    a = a * a % 1000000007;
  }
  return ans;
}
long long int inverse(long long int a, long long int p) {
  return fexp(a, p - 2);
}
long long int leng = 0;
long long int cou = 0;
long long int modify(long long int n) {
  long long int res = n;
  res %= 1000000007;
  res += 1000000007;
  res %= 1000000007;
  return res;
}
long long int min(long long int a, long long int b) {
  if (a > b) return b;
  return a;
}
long long int max(long long int a, long long int b) {
  if (a < b) return b;
  return a;
}
bool isPrime(int x) {
  if (x == 1) return false;
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}
void ingraph(vector<vector<long long int> > &graph, long long int m) {
  long long int x, y, z;
  for (long long int i = 0; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
}
void dfs(vector<vector<long long int> > &grap, vector<long long int> &color,
         long long int node, long long int par, long long int red,
         long long int blue) {
  long long int r = 0;
  long long int b = 0;
  if (color[node - 1] == 1) {
    r += 1;
  } else if (color[node - 1] == 2) {
    b += 1;
  }
  for (auto i : grap[node]) {
    if (i == par) continue;
    dfs(grap, color, i, node, red, blue);
  }
}
void dfs2(vector<long long int> &num, long long int v, long long int u) {
  vis[v] = num[v - 1];
  ans = max(ans, vis[v]);
  for (auto i : grap[v]) {
    if (i == u) continue;
    dfs2(num, i, v);
    ans = max(ans, vis[v] + vis[i] - mpp[1000000007 * v + i]);
    vis[v] = max(vis[v], num[v - 1] + vis[i] - mpp[1000000007 * v + i]);
  }
}
vector<long long int> fact(400001, 1);
bool myComparison(const pair<long long int, long long int> &a,
                  const pair<long long int, long long int> &b) {
  return a.second < b.second;
}
vector<long long int> primes;
void fill(long long int i, long long int l, long long int r, long long int d,
          vector<long long int> &v, vector<long long int> &tree) {
  if (l == r) {
    tree[i] = v[l - 1];
    return;
  }
  long long int mid = (l + r) / 2;
  fill(2 * i, l, mid, d + 1, v, tree);
  fill(2 * i + 1, mid + 1, r, d + 1, v, tree);
  tree[i] = max(tree[2 * i], tree[2 * i + 1]);
}
long long int query(long long int ind, vector<long long int> &tree,
                    long long int l, long long int r, long long int ql,
                    long long int qr) {
  if (ql <= l && qr >= r) {
    return tree[ind];
  } else if (ql > r || qr < l) {
    return 10000000000001;
  }
  long long int mid = (l + r) / 2;
  return min(query(2 * ind, tree, l, mid, ql, qr),
             query(2 * ind + 1, tree, mid + 1, r, ql, qr));
}
void build(vector<long long int> &t, vector<long long int> &a, int v, int tl,
           int tr) {
  if (tl == tr) {
    t[v] = a[tl];
  } else {
    int tm = (tl + tr) / 2;
    build(t, a, v * 2, tl, tm);
    build(t, a, v * 2 + 1, tm + 1, tr);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
}
void update(vector<long long int> &t, int v, int tl, int tr, int pos,
            int new_val) {
  if (tl == tr) {
    t[v] = new_val;
  } else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(t, v * 2, tl, tm, pos, new_val);
    else
      update(t, v * 2 + 1, tm + 1, tr, pos, new_val);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
}
int getmax(vector<long long int> &t, int i) {
  if (t[2 * i] == 0) {
    return i;
  }
  if (t[2 * i] == t[1]) {
    return getmax(t, 2 * i);
  } else {
    return getmax(t, 2 * i + 1);
  }
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<long long int> ma(2 * m + 4, 0);
  vector<long long int> vec(2 * m + 4, 0);
  for (long long int i = 0; i < n / 2; i++) {
    long long int sum = v[i] + v[n - 1 - i];
    ma[sum]++;
    vec[max(v[i] + m, v[n - 1 - i] + m) + 1] -= 1;
    vec[min(v[i], v[n - 1 - i]) + 1] += 1;
  }
  for (long long int i = 1; i < 2 * m + 3; i++) {
    vec[i] += vec[i - 1];
  }
  long long int ans = 10000000000001;
  for (long long int i = 1; i < 2 * m + 3; i++) {
    ans = min(ans, vec[i] - ma[i] + n - 2 * vec[i]);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n = 1;
  cin >> n;
  while (n--) {
    solve();
  }
  return 0;
}
