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:
//In rememberance to GOD//
//May GOD take care to me,my family and all the creatures//
#include<bits/stdc++.h>
using namespace std;
using namespace chrono;



#define ll long long
#define int ll   
#define mod ((int)1e9+7)
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vc vector<char>
#define vpi vector<pii>
#define vpic vector<pair<int,char>>
#define vpid vector<pair<int,double>>
#define vb vector<bool>
#define vvb vector<vb>
#define vs vector<string>
#define INF (ll)1e15
#define all(x)  (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define pb push_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define eb emplace_back

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

//fill memset iota function
// use 1ll<<number(left shift)

const int N=(int)1e5;


// int primes[N];
// // // int spf[N];
// vector<int> pr;
// vi pr1;

// void sieve(){

//     // iota(spf+2,spf+N,2);

// 	for(ll i=2;i<N;i++){
// 		if(primes[i]==0){
// 		 	pr.eb(i);
// 			for(ll j=i*i;j<N;j+=i){
//                 // if(spf[j]==j)
//                 // spf[j]=i;
// 				primes[j]=1;
// 			}
// 		}
// 		primes[i]^=1;
// 	}



// }
// nloglogn




ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
ll power(ll x, ll y) {ll res = 1;while (y > 0){ if (y & 1) res = (res*x)%mod;y = y>>1;x = x*x%mod;}return res;}
//avoid it in power of 2.
//logn implementation
//divisors in o(sqrt(n)) and no of divisors less than 2*(n^1/2);//128(max divisors for n<=1e5)
//for n>=1e5 no of divisors is less than n^1/3;
// use i&1 instead of i%2
//stoll convert string to integer(long long)
//  if(a>b) { return a/b+fun(b,a%b);} else return b/a+fun(a,b%a); technique of mod and minus similar answer but diffent time complexity.
// if(a>b) { return 1+fun(b,a-b);} else return 1+fun(a,b-a);
// class cmp { public:
//     bool operator()(const pair<int,pii> &p1,const pair<int,pii> &p2) const { if(p1.first!=p2.first) return p1.first>p2.first;else
//         {
//             if(p1.second.first!=p2.second.first)
//             {
//                 return p1.second.first>p2.second.first;
//             }
//             else
//             {
//                 return p1.second.second>p2.second.second;
//             }
            
//         }
        
//     }
 
// };
// instead of priority queue i use set defined with cmp class strictly using '=' sign in comparisons(work as multi set)
//erase function with values won't work
//to modify a set i use cmp class stictly without using '=' sign in comparions,example above!!!!  
//erase function with values will work
//sizeof terminate on spaces in charater array........
//prime gap o((logn)^2) approx
//prime gap till 1e9 is 282
//prime gap<sqrt(n)
//no of primes N/lnN till N
//we just have to remove a single element in order to remove equal sum partition subsequences and that too having minimun num of multiplication of two. 







/////////////////////////////////////// CODE ////////////////////////////////////////////////


// int dx[] = {1,0,-1,0};
// int dy[] = {0,1,0,-1};
// int dr[] = {1,1,0,-1,-1,-1, 0, 1}; // trick to explore an implicit 2D grid
// int dc[] = {0,1,1, 1, 0,-1,-1,-1};





// vi adj[N];
// int visited[N];
// int par[N];
// int d[N];
// int dp[N];



// int binary_searching(vi &v,int num,int sum)
// {
//     int n=v.size();
//     int start=0;
//     int end=n-1;

//     while(start+1!=end)
//     {
//         int mid=(start+end)/2;
//         if(sum-v[mid]>=num)
//         {
//             start=mid;
//         }
//         else
//         end=mid;
//     }

//     if(sum-v[start]==num)
//     {
//         return start;
//     }
//     else
//     {
//         return -1;
//     }
    

    
    
// }



// int index=-1;




// void dfs(int current,double & maxi,vector<double>&v)
// {
//     visited[current]=true;

//     for(auto x:adj[current])
//     {
//         int node=x.first;
//         int weight=x.second;

//         maxi=max(maxi,(v[current]+v[node])/weight);
//         if(!visited[node])
//         {
//             dfs(node,maxi,v);
//         }


//     }

// }



bool cmp(pii p1,pii p2)
{
    return p1.first>p2.first;
}


void solve()
{
    int n,m,x;
    cin>>n>>m>>x;


    vpi v(n);
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;

        v[i]={x,i};
    }

    sort(all(v),cmp);
    // for(auto &[x,y]:v)
    // {
    //     error(x);
    // }
    set<pii>s;
    vi ans(n);
    int maxi=-INF;
    int mini=INF;
    //height,tower index
    for(int i=0;i<m;i++)
    {
        s.emplace(v[i].first,i);
        ans[v[i].second]=i;
    }


    for(int i=m;i<n;i++)
    {
        auto it=s.begin();
        int height=it->first;
        int index=it->second;

        s.erase(it);
        height+=v[i].first;
        ans[v[i].second]=index;

        s.emplace(height,index);
    }

    for(auto &[x,y]:s)
    {
        maxi=max(maxi,x);
        mini=min(mini,x);
    }

    if(maxi-mini>x)
    {
        cout<<"NO"<<'\n';
        return;
    }



    cout<<"YES"<<'\n';
    for(auto x:ans)
    {
        cout<<x+1<<" ";
    }
    cout<<'\n';


    



    


    
    






























}








int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    // freopen("input.txt","rt",stdin);
	// freopen("output.txt","wt",stdout);

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t;
    cin>>t;


    // sieve();

    
    // t=1;

    
   

    

    for(int i=1;i<=t;i++)
    {
        solve();
        // IshanMakkar
        // time__("solve");
    }


    return 0;
}