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.*;
import java.util.*;

public class Stack2 {

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

    static Reader sc = new Reader();
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        /*
         * For integer input: int n=inputInt();
         * For long input: long n=inputLong();
         * For double input: double n=inputDouble();
         * For String input: String s=inputString();
         * Logic goes here
         * For printing without space: print(a+""); where a is a variable of any datatype
         * For printing with space: printSp(a+""); where a is a variable of any datatype
         * For printing with new line: println(a+""); where a is a variable of any datatype
         */
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int x = sc.nextInt();
            long sum = 0;
            List<List<Integer>> lists = new ArrayList<>();
            for (int j = 0; j <= x; j++) {
                lists.add(new ArrayList<>());
            }
            int[] ar = new int[n];
            for (int j = 0; j < n; j++) {
                ar[j] = sc.nextInt();
                sum += ar[j];
                lists.get(ar[j]).add(j);
            }
            int[] sol = new int[n];
            long[] hei = new long[m + 1];
            int div = (int) (sum / m);
            // System.out.println(div);
           /* for (int j = 1; j <= m; j++) {
                long sum1 = 0;
                for (int k = 0; k < n; k++) {
                    if ((sum1 + ar[k]) <= div && sol[k] == 0) {
                        sol[k] = j;
                        sum1 += ar[k];
                    }
                }
                hei[j] = sum1;
            }*/
           int minind=0;
            for (int j = 0; j <= x; j++) {
                for(Integer k:lists.get(j)){
                    if (sol[k] == 0) {
                  /*  long minsum = Long.MAX_VALUE;
                    int minind = -1;
                    for (int j = 1; j <= m; j++) {
                        if (hei[j] < minsum) {
                            minsum = hei[j];
                            minind = j;
                        }
                    }*/
                        sol[k] = minind+1;
                        hei[minind+1] += ar[k];
                        minind=(minind+1)%m;
                    }
                }
            }
           /* for (int k = 0; k < n; k++) {
                if (sol[k] == 0) {
                  *//*  long minsum = Long.MAX_VALUE;
                    int minind = -1;
                    for (int j = 1; j <= m; j++) {
                        if (hei[j] < minsum) {
                            minsum = hei[j];
                            minind = j;
                        }
                    }*//*
                    sol[k] = minind+1;
                    hei[minind+1] += ar[k];
                    minind=(minind+1)%m;
                }
            }*/
            Arrays.sort(hei);

            boolean check = true;
            if (hei[m] - hei[1] > x) {
                check = false;
            }
             /* for (int k = 1; k <=m-1; k++) {

                long diff=Math.abs(hei[k]-hei[k+1]);
                if(diff>x){
                    check=false;
                    break;
                }
            }*/
            if (check) {
                System.out.println("YES");
                for (Integer integer : sol) {
                    System.out.print(integer + " ");
                }
                System.out.println();
            } else {
                System.out.println("NO");
            }


        }

        bw.flush();
        bw.close();


    }

    public static void bfs(int r, int c, Queue<int[]> queue, long[][] dis, char[][] map, boolean[][] visited) {
        while (!queue.isEmpty()) {
            int[] ar = queue.poll();
            int x = ar[0];
            int y = ar[1];
            if (x + 1 < r) {
                if (map[x + 1][y] != 'T' && dis[x + 1][y] > (dis[x][y] + 1)) {
                    dis[x + 1][y] = Math.min(dis[x + 1][y], (dis[x][y] + 1));
                    queue.add(new int[]{x + 1, y});
                } /*else if (map[x][y] != map[x + 1][y] && dis[x + 1][y] > (dis[x][y] + 1)) {
                    dis[x + 1][y] = Math.min(dis[x + 1][y], dis[x][y] + 1);
                    queue.add(new int[]{x + 1, y});
                }*/
              /*  if(!visited[x+1][y] ){
                    queue.add(new int[]{x + 1, y});
                    visited[x+1][y]=true;
                }*/


            }
            if (y + 1 < c) {
                if (map[x][y + 1] != 'T' && dis[x][y + 1] > (dis[x][y] + 1)) {
                    dis[x][y + 1] = Math.min(dis[x][y + 1], dis[x][y] + 1);
                    queue.add(new int[]{x, y + 1});
                } /*else if (map[x][y] != map[x][y + 1] && dis[x][y + 1] > (dis[x][y] + 1)) {
                    dis[x][y + 1] = Math.min(dis[x][y + 1], dis[x][y] + 1);
                    queue.add(new int[]{x, y + 1});
                }*/
               /* if( !visited[x][y+1]){
                    queue.add(new int[]{x, y+1});
                    visited[x][y+1]=true;
                }*/


            }
            if (x - 1 >= 0) {
                if (map[x - 1][y] != 'T' && dis[x - 1][y] > (dis[x][y] + 1)) {
                    dis[x - 1][y] = Math.min(dis[x - 1][y], (dis[x][y] + 1));
                    queue.add(new int[]{x - 1, y});
                } /*else if (map[x][y] != map[x - 1][y] && dis[x - 1][y] > (dis[x][y] + 1)) {
                    dis[x - 1][y] = Math.min(dis[x - 1][y], dis[x][y] + 1);
                    queue.add(new int[]{x - 1, y});
                }*/
               /* if(!visited[x-1][y]){
                    queue.add(new int[]{x - 1, y});
                    visited[x-1][y]=true;
                }*/


            }
            if (y - 1 >= 0) {
                if (map[x][y - 1] != 'T' && dis[x][y - 1] > (dis[x][y] + 1)) {
                    dis[x][y - 1] = Math.min(dis[x][y - 1], (dis[x][y] + 1));
                    queue.add(new int[]{x, y - 1});
                } /*else if (map[x][y] != map[x][y - 1] && dis[x][y - 1] > (dis[x][y] + 1)) {
                    dis[x][y - 1] = Math.min(dis[x][y - 1], dis[x][y] + 1);
                    queue.add(new int[]{x, y - 1});
                }*/
               /* if(!visited[x][y-1]){
                    queue.add(new int[]{x , y-1});
                    visited[x][y-1]=true;
                }*/


            }
        }
    }


    public static void dfs1(List<List<Integer>> g, boolean[] visited, Stack<Integer> stack, int num) {
        visited[num] = true;
        for (Integer integer : g.get(num)) {
            if (!visited[integer]) {
                dfs1(g, visited, stack, integer);
            }
        }
        stack.push(num);
    }

    public static void dfs2(List<List<Integer>> g, boolean[] visited, List<Integer> list, int num, int c, int[] raj) {
        visited[num] = true;

        for (Integer integer : g.get(num)) {
            if (!visited[integer]) {
                dfs2(g, visited, list, integer, c, raj);
            }
        }
        raj[num] = c;
        list.add(num);

    }

    public static int inputInt() throws IOException {
        return sc.nextInt();
    }

    public static long inputLong() throws IOException {
        return sc.nextLong();
    }

    public static double inputDouble() throws IOException {
        return sc.nextDouble();
    }

    public static String inputString() throws IOException {
        return sc.readLine();
    }

    public static void print(String a) throws IOException {
        bw.write(a);
    }

    public static void printSp(String a) throws IOException {
        bw.write(a + " ");
    }

    public static void println(String a) throws IOException {
        bw.write(a + "\n");
    }


    public static long getAns(int[] ar, int c, long[][] dp, int i, int sign) {
        if (i < 0) {
            return 1;
        }

        if (c <= 0) {
            return 1;
        }

        dp[i][c] = Math.max(dp[i][c], Math.max(ar[i] * getAns(ar, c - 1, dp, i - 1, sign), getAns(ar, c, dp, i - 1, 1)));
        return dp[i][c];
    }


    public static long power(long a, long b, long c) {
        long ans = 1;
        while (b != 0) {
            if (b % 2 == 1) {
                ans = ans * a;
                ans %= c;
            }
            a = a * a;
            a %= c;
            b /= 2;
        }
        return ans;
    }

    public static long power1(long a, long b, long c) {
        long ans = 1;
        while (b != 0) {
            if (b % 2 == 1) {
                ans = multiply(ans, a, c);
            }
            a = multiply(a, a, c);
            b /= 2;

        }
        return ans;

    }

    public static long multiply(long a, long b, long c) {
        long res = 0;
        a %= c;
        while (b > 0) {
            if (b % 2 == 1) {
                res = (res + a) % c;
            }
            a = (a + a) % c;
            b /= 2;
        }

        return res % c;

    }

    public static long totient(long n) {
        long result = n;
        for (long i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                //sum=sum+2*i;
                while (n % i == 0) {
                    n /= i;
                    // sum=sum+n;
                }
                result -= result / i;

            }
        }
        if (n > 1) {
            result -= result / n;

        }
        return result;
    }


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

    public static boolean[] primes(int n) {
        boolean[] p = new boolean[n + 1];
        p[0] = false;
        p[1] = false;
        for (int i = 2; i <= n; i++) {
            p[i] = true;
        }

        for (int i = 2; i * i <= n; i++) {
            if (p[i]) {
                for (int j = i * i; j <= n; j += i) {
                    p[j] = false;
                }
            }

        }
        return p;
    }

}