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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class Main {
    static int mod = (int) (1e9) + 7;

    /* ======================DSU===================== */
    static class dsu {
        static int parent[], n;// min[],value[];
        static long size[];

        dsu(int n) {
            parent = new int[n + 1];
            size = new long[n + 1];
            // min=new int[n+1];
            // value=new int[n+1];
            this.n = n;
            makeSet();
        }

        static void makeSet() {
            for (int i = 1; i <= n; i++) {
                parent[i] = i;
                size[i] = 1;
                // min[i]=i;
            }
        }

        static int find(int a) {
            if (parent[a] == a)
                return a;
            else {
                return parent[a] = find(parent[a]);// Path Compression
            }
        }

        static void union(int a, int b) {
            int setA = find(a);
            int setB = find(b);
            if (setA == setB)
                return;
            if (size[setA] >= size[setB]) {
                parent[setB] = setA;
                size[setA] += size[setB];
            } else {
                parent[setA] = setB;
                size[setB] += size[setA];
            }
        }
    }

    /* ======================================================== */
    static class Pair implements Comparator<Pair> {
        long lx, ly;
        int ix, iy;

        // Constructor
        public Pair(long x, long y) {
            // System.out.println("F1");
            this.lx = x;
            this.ly = y;
            this.ix = (int) x;
            this.iy = (int) y;
        }

        public Pair(int x, int y) {
            // System.out.println("F");
            this.ix = x;
            this.iy = y;
            this.lx = ix;
            this.ly = iy;
            // System.out.println(this.lx);
        }

        public Pair() {
        }

        @Override
        public int compare(Main.Pair o1, Main.Pair o2) {
            // System.out.println( (o1.iy - o2.iy));
            return ((int) (o1.ix - o2.ix));// Ascending Order
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] intArr(int n) {
            int res[] = new int[n];
            for (int i = 0; i < n; i++)
                res[i] = nextInt();
            return res;
        }

        long[] longArr(int n) {
            long res[] = new long[n];
            for (int i = 0; i < n; i++)
                res[i] = nextLong();
            return res;
        }
    }

    static FastReader f = new FastReader();
    static BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));

    static boolean isPrime(long n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 || n % 3 == 0)
            return false;
        for (long i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;
        return true;
    }

    static int lowerBound(int a[], int x) { // x is the target, returns lowerBound. If not found return -1
        int l = -1, r = a.length, flag = 0;
        while (l + 1 < r) {
            int m = (l + r) >>> 1;
            if (x == a[m])
                flag = 1;
            if (a[m] >= x)
                r = m;
            else
                l = m;
        }
        return flag == 0 ? -1 : r;
    }

    static int upperBound(int a[], int x) {// x is the target, returns upperBound. If not found return -1
        int l = -1, r = a.length, flag = 0;
        while (l + 1 < r) {
            int m = (l + r) >>> 1;
            if (a[m] == x)
                flag = 1;
            if (a[m] <= x)
                l = m;
            else
                r = m;
        }
        return flag == 0 ? -1 : (l + 1);
    }

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

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    static long power(long x, long y, long p) {
        long res = 1;
        x = x % p;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x) % p;
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }
        return res;
    }

    static long power(long x, long y) {
        long res = 1;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x);
            y >>= 1;
            x = (x * x);
        }
        return res;
    }

    public double binPow(double x, int n) {// binary exponentiation with negative power as well
        if (n == 0)
            return 1.0;
        double binPow = binPow(x, n / 2);
        if (n % 2 == 0) {
            return binPow * binPow;
        } else {
            return n > 0 ? (binPow * binPow * x) : (binPow * binPow / x);
        }
    }

    static long ceil(long x, long y) {
        return (x % y == 0 ? x / y : (x / y + 1));
    }

    /*
     * ===========Modular Operations==================
     */
    static long modInverse(long n, long p) {
        return power(n, p - 2, p);
    }

    static long modAdd(long a, long b) {
        return ((a + b + mod) % mod);
    }

    static long modMul(long a, long b) {
        return ((a % mod) * (b % mod)) % mod;
    }

    static long nCrModPFermat(int n, int r) {
        if (r == 0)
            return 1;
        long[] fac = new long[n + 1];
        fac[0] = 1;
        for (int i = 1; i <= n; i++)
            fac[i] = fac[i - 1] * i % mod;
        return (fac[n] * modInverse(fac[r], mod) % mod * modInverse(fac[n - r], mod) % mod) % mod;
    }

    /*
     * ===============================================
     */
    static List<Character> removeDup(ArrayList<Character> list) {
        List<Character> newList = list.stream().distinct().collect(Collectors.toList());
        return newList;
    }

    static void ruffleSort(long[] a) {
        int n = a.length;
        Random r = new Random();
        for (int i = 0; i < a.length; i++) {
            int oi = r.nextInt(n);
            long temp = a[i];
            a[i] = a[oi];
            a[oi] = temp;
        }
        Arrays.sort(a);
    }

    static void ruffleSort(int[] a) {
        int n = a.length;
        Random r = new Random();
        for (int i = 0; i < a.length; i++) {
            int oi = r.nextInt(n);
            int temp = a[i];
            a[i] = a[oi];
            a[oi] = temp;
        }
        Arrays.sort(a);
    }

    static String binString32(int n) {
        StringBuilder str = new StringBuilder("");
        String bin = Integer.toBinaryString(n);
        if (bin.length() != 32) {
            for (int k = 0; k < 32 - bin.length(); k++) {
                str.append("0");
            }
            str.append(bin);
        }
        return str.toString();
    }

    /*
     * ====================================Main=================================
     */

    // static int st[], a[], levl[], n, m;

    // static void buildTree(int treeIndex, int lo, int hi) {
    // if (hi == lo) {
    // // System.out.println(a[lo]);
    // levl[treeIndex] = levl[(treeIndex - 1) / 2] + 1;
    // st[treeIndex] = a[lo];
    // return;
    // }
    // int mid = (lo + hi) / 2;
    // if (treeIndex != 0) {
    // // System.out.println(treeIndex + " " + (treeIndex - 1) / 2);
    // levl[treeIndex] = levl[(treeIndex - 1) / 2] + 1;
    // }
    // buildTree(treeIndex * 2 + 1, lo, mid);
    // buildTree(treeIndex * 2 + 2, mid + 1, hi);
    // if (n % 2 == 1) {
    // if (levl[treeIndex] % 2 == 0) {
    // st[treeIndex] = or(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // } else {
    // st[treeIndex] = xor(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // }
    // } else {
    // if (levl[treeIndex] % 2 == 1) {
    // st[treeIndex] = or(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // } else {
    // st[treeIndex] = xor(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // }
    // }

    // }

    // static void update(int treeIndex, int lo, int hi, int arrIndex, int val) {
    // // System.out.println(hi + " " + lo + " " + treeIndex);
    // if (hi == lo) {
    // st[treeIndex] = val;
    // a[arrIndex] = val;
    // return;
    // }
    // int mid = (hi + lo) / 2;
    // if (mid < arrIndex) {
    // update(treeIndex * 2 + 2, mid + 1, hi, arrIndex, val);
    // } else {
    // update(treeIndex * 2 + 1, lo, mid, arrIndex, val);
    // }
    // if (n % 2 == 1) {
    // if (levl[treeIndex] % 2 == 0) {
    // // System.out.println(treeIndex+" = "+(2*treeIndex+1)+" or
    // "+(2*treeIndex+2));
    // st[treeIndex] = or(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // } else {
    // // System.out.println(treeIndex+" = "+(2*treeIndex+1)+" xor
    // "+(2*treeIndex+2));
    // st[treeIndex] = xor(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // }
    // } else {
    // if (levl[treeIndex] % 2 == 1) {
    // // System.out.println(treeIndex+" = "+(2*treeIndex+1)+" or
    // "+(2*treeIndex+2));
    // st[treeIndex] = or(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // } else {
    // // System.out.println(treeIndex+" = "+(2*treeIndex+1)+" xor
    // "+(2*treeIndex+2));
    // st[treeIndex] = xor(st[treeIndex * 2 + 1], st[treeIndex * 2 + 2]);
    // }
    // }
    // }

    // static int query(int treeIndex, int lo, int hi, int l, int r) {
    // if (l <= lo && r >= hi) {
    // return st[treeIndex];
    // }
    // if (l > hi || r < lo) {
    // return 0;
    // }
    // int mid = (hi + lo) / 2;
    // int p = 0;
    // if (n % 2 == 0) {
    // if (levl[treeIndex] % 2 == 0) {
    // p = or(query(treeIndex * 2 + 1, lo, mid, l, Math.min(mid, r)),
    // query(treeIndex * 2 + 2, mid + 1, hi, Math.max(l, mid + 1), r));
    // } else {
    // p = xor(query(treeIndex * 2 + 1, lo, mid, l, Math.min(mid, r)),
    // query(treeIndex * 2 + 2, mid + 1, hi, Math.max(l, mid + 1), r));
    // }
    // } else {
    // if (levl[treeIndex] % 2 == 1) {
    // p = or(query(treeIndex * 2 + 1, lo, mid, l, Math.min(mid, r)),
    // query(treeIndex * 2 + 2, mid + 1, hi, Math.max(l, mid + 1), r));
    // } else {
    // p = xor(query(treeIndex * 2 + 1, lo, mid, l, Math.min(mid, r)),
    // query(treeIndex * 2 + 2, mid + 1, hi, Math.max(l, mid + 1), r));
    // }
    // }
    // return p;
    // }

    // static int or(int a, int b) {
    // return a | b;
    // }

    // static int xor(int a, int b) {
    // return a ^ b;
    // }
    // static int n;
    // static int solve(int i,int j){
    // if(n==0 && m==0){
    // returm Integer.MAX_VALUE;
    // }
    // if(n>)
    // }
    public static void main(String args[]) throws Exception {
        // File file = new File("D:\\VS Code\\Java\\Output.txt");
        // FileWriter fw = new FileWriter("D:\\VS Code\\Java\\Output.txt");
        Random rand = new Random();
        int t = 1;
        t = f.nextInt();
        int tc = 1;

        while (t-- != 0) {
            int n=f.nextInt();
            int m=f.nextInt();
            int x=f.nextInt();
            int a[]=new int[n];
            a=f.intArr(n);
            w.write("YES\n");
            if(n==m){
                for(int i=1;i<=n;i++){
                    w.write(i+" ");
                }
                w.write("\n");
            }else{
                PriorityQueue<Pair> pq=new PriorityQueue<>(n,new Pair());
                for(int i=1;i<=m;i++){
                    pq.add(new Pair(0,i));
                }
                for(int i=0;i<n;i++){
                    Pair head=pq.poll();
                    int sum=head.ix + a[i];
                    w.write(head.iy+" ");
                    pq.add(new Pair(sum,head.iy));
                }
                w.write("\n");
            }
        }
        w.flush();
    }
}