#include <bits/stdc++.h>   using namespace std;   #pragma warning(disable : 4996)   const double eps = 1e-7;   struct node {     long long first;     node() {}     node(long long first) : first(first) {}     bool operator<(const node& a) const { return first < a.first; }   };   int dx[4] = {-1, 1, 0, 0};   int dy[4] = {0, 0, -1, 1};   const long long N = 6010;   long long mod = 1e9 + 7;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n, k;       cin >> n >> k;       long long tmp = 0;       long long ans = 0;       priority_queue<node> q;       for (int i = 1; i <= n * k; i++) {         cin >> tmp;         node tt(tmp);         q.push(tt);       }       int cnt = 0;       if (n & 1) {         for (int i = 1; i <= k; i++) {           for (int j = 1; j <= (n + 1) / 2; j++) {             if (j == (n + 1) / 2) {               ans += q.top().first;               cnt++;             }             q.pop();           }         }       } else {         for (int i = 1; i <= k; i++) {           for (int j = 1; j <= n / 2 + 1; j++) {             if (j == n / 2 + 1) {               ans += q.top().first;               cnt++;             }             q.pop();           }         }       }       cout << ans <<   n ;     }   }   