Problem: Phoenix has n blocks of height h_1, h_2, ..., h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look beautiful, no two towers may have a height difference of strictly more than x. 

Please help Phoenix build m towers that look beautiful. Each tower must have at least one block and all blocks must be used.

Input

The input consists of multiple test cases. The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first line of each test case contains three integers n, m, and x (1 ≤ m ≤ n ≤ 10^5; 1 ≤ x ≤ 10^4) — the number of blocks, the number of towers to build, and the maximum acceptable height difference of any two towers, respectively. 

The second line of each test case contains n space-separated integers (1 ≤ h_i ≤ x) — the heights of the blocks. 

It is guaranteed that the sum of n over all the test cases will not exceed 10^5.

Output

For each test case, if Phoenix cannot build m towers that look beautiful, print NO. Otherwise, print YES, followed by n integers y_1, y_2, ..., y_n, where y_i (1 ≤ y_i ≤ m) is the index of the tower that the i-th block is placed in.

If there are multiple solutions, print any of them.

Example

Input


2
5 2 3
1 2 3 1 2
4 3 3
1 1 2 3


Output


YES
1 1 1 2 2
YES
1 2 2 3

Note

In the first test case, the first tower has height 1+2+3=6 and the second tower has height 1+2=3. Their difference is 6-3=3 which doesn't exceed x=3, so the towers are beautiful.

In the second test case, the first tower has height 1, the second tower has height 1+2=3, and the third tower has height 3. The maximum height difference of any two towers is 3-1=2 which doesn't exceed x=3, so the towers are beautiful.

Solution (in CPP):

Solution:
//n & (1<<i)- for extracting ith bits
//while(n>0){count=count+(n&1); n=n>>1;}//counting set bits

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x) x.begin(),x.end()
const int INF = 1000000000000000;
// bool cmp(pair<string, int>& a,
//          pair<string, int>& b)
// {
//     return a.second < b.second;
// }

// int gcd(int a, int b){
// if (a==0){
//     return b;
// }
// return gcd(b%a,a);


// }

// int factorial(int n)
// {
//     // single line to find factorial
//     return (n==1 || n==0) ? 1: (n * factorial(n - 1)%mod);
// }


// string add(string a,string b){
// 	if(a.size()<b.size())swap(a,b);
// 	string ans;
// 	int n=a.size();
// 	int n1=a.size()-b.size();
// 	string temp;
// 	for(int i=0;i<n1;i++)temp+="0";
// 	b=temp+b;
// 	int car=0;
// 	for(int i=n-1;i>=0;i--){
// 		ans+=(char)((a[i]-'0'+b[i]-'0'+car)%10+'0');
// 		car=(a[i]-'0'+b[i]-'0'+car)/10;
// 	}
// 	if(car)ans+=(char)(car+'0');
// 	reverse(all(ans));
// 	return ans;
// }

// bool cmp(string s1,string s2){
// 	if(s1.size()!=s2.size())return s1.size()<s2.size();
// 	int n=s1.size();
// 	for(int i=0;i<n;i++)
// 		if(s1[i]>s2[i])return 0;
// 		else if(s1[i]<s2[i])return 1;
// 	return 1;
// }


// vector<int> z_function(string s) {
//     int n = (int) s.length();
//     vector<int> z(n);
//     for (int i = 1, l = 0, r = 0; i < n; ++i) {
//         if (i <= r)
//             z[i] = min (r - i + 1, z[i - l]);
//         while (i + z[i] < n && s[z[i]] == s[i + z[i]])
//             ++z[i];
//         if (i + z[i] - 1 > r)
//             l = i, r = i + z[i] - 1;
//     }
//     return z;
// }


// int modp(int a, int b)
// {
//     int ans=1;
//     while(b)
//     {
//         if(b&1)
//             ans=(ans*a)%mod;
//         b/=2;
//         a=(a*a)%mod;
//     }
//     return ans;
// }



// void reverseStr(string& str)
// {
//     int n = str.length();

//     // Swap character starting from two
//     // corners
//     for (int i = 0; i < n / 2; i++)
//         swap(str[i], str[n - i - 1]);
// }

// void bfs(vector<set<int>> g, int s, int dist[])
// {
// 	bool mark[1010]; memset(mark, 0, sizeof mark);
// 	dist[s] = 0;
// 	queue<int> q;
// 	q.push(s);
// 	mark[s] = 1;
// 	while (!q.empty())
// 	{
// 		int u = q.front();
// 		q.pop();
// 		for (auto v : g[u])
// 		{
// 			if (mark[v]) continue;
// 			dist[v] = 1 + dist[u];
// 			mark[v] = 1;
// 			q.push(v);
// 		}
// 	}
// }



// vector<pair<int,int>> wg[100050];

// int f=0;
// //vi d(100050,INF);
 
// vi dijkstra(int src)
// {
//     set<pair<int,int>> s;

//     // vi parent(n+1,-1);
    
//     d[src]=0;
//     s.insert({0,src});
//     while(!s.empty()){
//         int i=s.begin()->second;
//         s.erase(s.begin());
//         for (auto & e:wg[i]){
//             int nb=e.first;
//             int w=e.second;
//             if (d[i]+w<d[nb]){
//                 s.erase({d[nb],nb});
//                 d[nb]=d[i]+w;
//                 s.insert({d[nb],nb});
//                 // parent[nb]=i;
//             }
//         }
//     }
//    // return parent;
//     return d;

// }

// int lim=150005;
// int sz;
// vector<int> adj[150005];
// vi vis(lim,0);

// void dfs(int x){
// if (vis[x]==1)
//     return;

// sz++;
// vis[x]=1;

// for (auto &it:adj[x]){
//     if (vis[it]!=1){
//         dfs(it);
//     }
// }
// }


/************************************** MAIN PROGRAM ********************************************/

int gcd(int a, int b){
if (a==0){
    return b;
}
return gcd(b%a,a);


}

int32_t main(){
fastIO;

w(x){
    int n,m,x;
    cin>>n>>m>>x;
   vi a(n);
   vi b(m);
   int c=0;
  vi index[100002];
   map<int,int> cnt;
   for (int i=0;i<n;i++){
    cin>>a[i];
    index[a[i]].pb(i);
    cnt[a[i]]=0;
   }
   
   
   int t=0;
   sort(a.begin(),a.end());
   vi ans(n);
    map<int,int>iused;
   for (int i=n-1;i>=0;i--){
    if (c%2==0){
        b[t]+=a[i];
        ans[index[a[i]][cnt[a[i]]]]=t;
        cnt[a[i]]++;
        
        t++;
        

        if(t==m){
            t=m-1;
            c++;
        }
    }
    else {
        b[t]+=a[i];
        
        ans[index[a[i]][cnt[a[i]]]]=t;
        cnt[a[i]]++;
        t--;
       
        if(t==-1){
            t=0;
            c++;
        }
    }
   }

   sort(b.begin(),b.end()); 
   if (b[m-1]-b[0]<=x){
    cout<<"YES"<<endl;
   
    
    for (int i=0;i<n;i++){
    cout<<ans[i]+1<<" ";
    }
    cout<<endl;
   }
   else {
    cout<<"NO"<<endl;
   }
    
}

return 0;
}