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

#define endl "\n"
#define int long long

void solver() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N;
    cin >> N;

    vector<int> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        p[i]--;
    }

    vector<int> ans;
    for (int i = 0; i < N; i++) {
        int j = find(p.begin(), p.end(), i) - p.begin();
        if (i == j) {
            continue;
        }
        if (j % 2 == ans.size() % 2) {
            if (j >= i + 2) {
                ans.push_back(j - 2);
                swap(p[j - 2], p[j - 1]);
            } else {
                ans.push_back(i - 1);
                ans.push_back(i);
                ans.push_back(i - 1);
                ans.push_back(i);
                ans.push_back(i - 1);
                swap(p[i], p[i + 1]);
                continue;
            }
        }
        for (int k = j - 1; k >= i; k--) {
            ans.push_back(k);
            swap(p[k], p[k + 1]);
        }
    }
        
    cout << ans.size() << endl;
    for (auto v : ans) { 
        cout << v + 1 << " ";
    }
    cout << endl;
}

int32_t main() {
    int N;
    cin >> N;

    for (int i = 0; i < N; i++) {
        solver();
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
const ll mod = 1e9+7;



main(){
    int n;cin>>n;
    ll x[n];
    for(int i=0;i<n;i++) cin>>x[i];
    ll man=0,cheb = 0;
    double euc=0;
    for(int i=0;i<n;i++){
        man+= abs(x[i]);
        cheb = max(cheb,(ll)abs(x[i]));
        euc+= (x[i]*x[i]);
    }
    cout<<man<<"\n"<<fixed<<setprecision(10)<<sqrt(euc)<<"\n"<<cheb;
}