#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vc vector<char>
#define vll vector <long long>
#define vi vector <int>
#define vld vector<long double>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define all(v) v.begin(),v.end()
#define repl(i,a,b) for(long long i=a;i<b;i++)
#define repi(i,a,b) for(int i=a;i<b;i++)
#define nl cout<<endl
#define e endl
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define lb(a,x) lower_bound(a.begin(),a.end(),x)
#define ub(a,x) upper_bound(a.begin(),a.end(),x)
#define f first
#define sc second
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define in(v) for(int i=0;i<v.size();i++) cin>>v[i];
#define debug(x) cout<<#x<<" "<<x<<endl;
int lo(char s){
if(s>='a' && s<='z') return 1;
else if(s>='A' && s<='Z') return 2;
else return 0;
}
void vp() {
int n,k; cin >> n >> k ;
int n2 = n ;
vll v(n,-1) ;
// int c = 0 ;
repi( j , 0 , k/2 ) {
for(int i = 2*j ; i < n ; i += k ) {
v[i] = n2 ;
n2-- ;
}
}
n2=1;
for(int j=k/2-1 ; j>=0 ; j-- ){
for(int i = 2*j+1 ; i<n;i+=k ){
v[i] = n2;
n2++;
}
}
//2 1 0 -> 5 3 1
for(auto i:v) cout<<i<<" "; nl;
}
int main()
{
IOS;
ll t=1;
cin >> t;
while (t--)
vp();
return 0;
}
152C - Pocket Book | 1681D - Required Length |
1725D - Deducing Sortability | 1501A - Alexey and Train |
721B - Passwords | 1263D - Secret Passwords |
1371B - Magical Calendar | 1726E - Almost Perfect |
1360C - Similar Pairs | 900A - Find Extra One |
1093D - Beautiful Graph | 748A - Santa Claus and a Place in a Class |
1511B - GCD Length | 676B - Pyramid of Glasses |
597A - Divisibility | 1632A - ABC |
1619D - New Year's Problem | 242B - Big Segment |
938A - Word Correction | 159C - String Manipulation 10 |
258A - Little Elephant and Bits | 1536C - Diluc and Kaeya |
1428C - ABBB | 1557A - Ezzat and Two Subsequences |
255A - Greg's Workout | 1059A - Cashier |
1389C - Good String | 1561A - Simply Strange Sort |
1337B - Kana and Dragon Quest game | 137C - History |