rt
#include<iostream>
#include<cstring>
using namespace std;
int n,k,x[1000010],f1;
long long d;
int t;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>t;
while(t--){
f1=0;
for(int i=1;x[i];i++) x[i]=0;
cin>>n>>d>>k;
if(n==1){
if(d!=0) cout<<"NO";
cout<<'\n';
continue;
}
if(k>n-1||d<n-1){
cout<<"NO\n";
continue;
}
d=d-n+1,x[1]=n-1;
int i1=1;
while(d){
int x1=min(d,(long long)x[i1]-k);
if(x1<k){
cout<<"NO\n";
f1=1;
break;
}
x[i1]-=x1;
x[++i1]+=x1;
d-=x1;
}
if(f1) continue;
cout<<"YES\n";
int cnt=i1,j=2,lastf=1;
for(int i=1;i<=cnt;i++){
int j1=j;
while(x[i]){
cout<<lastf<<" ";
j1++;
x[i]--;
}
lastf=j;
j=j1+1;
}
cout<<'\n';
}
}