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 8
7 9
7 10
7 11
7 12
8 9
8 10
8 11
9 10
9 11
9 12
10 12
 4 3
2 1
3 1
4 2
 3 1
2 3
 6 10
1 2
1 3
1 4
1 6
2 3
2 4
2 5
3 5
3 6
4 6
 11 49
10 3
6 4
11 3
7 6
10 6
6 1
4 3
10 2
4 5
9 2
10 1
5 7
1 5
9 7
2 11
8 6
3 9
2 5
9 5
6 5
1 4
11 9
1 7
8 10
3 6
3 7
11 5
6 9
4 10
8 7
4 9
8 2
4 2
8 11
7 4
9 10
8 1
10 7
3 2
5 8
8 9
1 3
2 7
10 11
5 3
10 5
4 11
1 11
8 3
 5 4
1 4
2 3
4 3
4 2
 4 3
1 2
3 1
4 3
 4 3
1 3
1 4
2 3
 10 36
7 8
7 9
2 3
2 4
2 5
9 10
2 7
2 8
2 9
2 10
4 5
4 6
4 7
4 8
4 10
6 7
6 9
6 10
1 2
1 3
1 4
8 9
1 5
8 10
1 7
1 8
1 9
1 10
3 4
3 6
3 7
3 9
5 6
5 7
5 9
5 10
 8 15
2 1
4 5
2 4
3 4
2 5
3 5
2 6
3 6
5 6
4 6
2 7
3 8
2 8
3 7
6 7

3
1 2 4 
 3
1 2 5 
 2
1 3 
 1
8 
 1
10 
 2
1 4 
 1
2 
 3
1 3 4 
 2
1 1 
 1
6 
 3
1 4 7 
 4
1 1 1 9 
 1
4 
 1
3 
 1
6 
 5
1 1 1 2 6 
 1
5 
 1
4 
 1
4 
 2
2 8 
 1
8 

//package com.company;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;


public class Main {
    static int mod = 1000000007;
    public static void main(String[] args) throws IOException {
        MyScanner sc = new MyScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        D(sc, pw);
        pw.close();
    }

    public static void A(MyScanner sc, PrintWriter pw) throws IOException {
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] krr = new int[k];
//            int[] arr = new int[n];
//            for (int j = 0; j < n; j++) {
//                arr[j] = 0;
//            }
            for (int j = 0; j < k; j++) {
                krr[j] = sc.nextInt() - 1;
            }
            int max = 0;
            for (int j = 0; j < n; j++) {
                int min = 300;
                for (int l = 0; l < k; l++) {
                    min = Math.min(min, Math.abs(j - krr[l]) + 1);
                }
                max = Math.max(max, min);
            }
            pw.println(max);
        }

    }
    public static class Student{
        int come; int leave; int idx; int tea = 0;
    }
    public static void B(MyScanner sc, PrintWriter pw)  throws  IOException{
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            Student[] s = new Student[n];
            for (int j = 0; j < n; j++) {
                int a = sc.nextInt(); int b = sc.nextInt();
                s[j] = new Student(); s[j].come = a; s[j].leave = b; s[j].idx = j;
            }
            Arrays.sort(s, new Comparator<Student>() {
                @Override
                public int compare(Student s1, Student s2) {
                    if (s1.come == s2.come) return s1.idx - s2.idx;
                    return s1.come - s2.come;
                }
            });
            int time = 1;
            for (int j = 0; j < n; j++) {
                Student ss = s[j];
                if (time < ss.come) time = ss.come;
                if (time > ss.leave) continue;
                ss.tea = time; time++;
            }
            Arrays.sort(s, new Comparator<Student>() {
                @Override
                public int compare(Student s1, Student s2) {
                    return s1.idx - s2.idx;
                }
            });
            for (int j = 0; j < n; j++) {
                pw.print(s[j].tea); pw.print(" ");
            }
            pw.println();
        }

    }
    public static void C(MyScanner sc, PrintWriter pw) throws IOException {
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        String s = sc.next();
        int[] cntarr = new int[n];
        int bf1 = -1;
        for (int i = 0; i < n; i++) {
            int c;
            if (i == n - 1){
                c = 0;
            } else {
                c = s.charAt(i) - '0';
            }
            if (c == 0 && bf1 == -1){
                if (arr[i] != i + 1){
                    pw.println("NO");return;
                }
            } else if (c == 0){
                cntarr[arr[i] - 1] = 1;
                for (int j = bf1; j <= i; j++) {
                    cntarr[j] -= 1;
                    if (cntarr[j] != 0){
                        pw.println("NO");return;

                    }
                }
                bf1 = -1;

            } else if (c == 1 && bf1 == -1){
                bf1 = i;
                cntarr[arr[i] - 1] += 1;
            } else if (c == 1){
                cntarr[arr[i] - 1] += 1;
            }
        }
        pw.println("YES");
    }
    public static void D(MyScanner sc, PrintWriter pw) throws IOException {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int v = sc.nextInt();
        int[] cnt = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            cnt[i] = sc.nextInt();
            sum += cnt[i];
        }
        if (sum < v) {
            pw.println("NO"); return;
        }
        int[][] dp = new int[n + 1][k];
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < k; j++) {
                if (dp[i][j] != 0){
                    dp[i+1][j] = 1;
                    dp[i+1][(j + cnt[i])%k] = 1;
                }
            }
        }
        int st = v % k;
        if (dp[n][st] == 0){
            pw.println("NO"); return;
        }
        int[] need = new int[n];
        int loidx = -1;
        int unuseidx = -1;
        for (int i = n; i > 0; i--) {
            if (dp[i - 1][st] != 0){
                if (unuseidx == -1) unuseidx = i - 1;
                continue;
            } else {
                st = st + 5000 - (cnt[i - 1] % k); st %= k;
                need[i - 1] = 1;
                if (loidx == -1)  loidx = i - 1;
            }
        }
        if (loidx == -1){
            if (sum - (sum % k) >= v) {
                pw.println("YES");
                for (int i = 1; i < n; i++) {
                    int cn;
                    if (cnt[i] % k == 0) cn = cnt[i] / k;
                    else {
                        cn = cnt[i] / k + 1;
                    }
                    pw.println(cn + " " + (i + 1) + " " + 1);
                }
                int nnn = v / k;
                if (nnn == 0) return;
                pw.println(nnn + " " + 1 + " " + 2);
                return;
            } else {
                pw.println("NO");return;
            }
        } else {
            int parsum = 0;
            for (int i = 0; i < n; i++) {
                if (need[i] == 0) {
                    parsum += cnt[i];
                }
            }
            if (sum - (parsum % k) < v){
                pw.println("NO"); return;
            } else {
                pw.println("YES");
                if (unuseidx == -1) unuseidx = 0;
                for (int i = 0; i < n; i++) {
                    int cn;
                    if (cnt[i] % k ==0) cn = cnt[i] / k;
                    else {
                        cn = cnt[i] / k + 1;
                    }
                    if (need[i] == 0) {
                        if (i == unuseidx) continue;
                        pw.println(cn + " " + (i+1) + " " + (unuseidx + 1));
                    } else {
                        if (i == loidx) continue;
                        pw.println(cn + " " + (i + 1) + " " + (loidx + 1));
                    }
                }
                if (unuseidx != loidx && sum - parsum < v){
                    int nnn = (v - (sum - parsum)) / k;
                    pw.println(nnn + " " + (unuseidx + 1) + " " + (loidx + 1));
                } else if (sum - parsum > v) {
                    int nnn = ((sum - parsum) - v) / k;
                    pw.println(nnn + " " + (loidx + 1) + " " + ((loidx + 2) % n));
                }
            }

        }
    }
    public static void E(MyScanner sc, PrintWriter pw){

    }
    public static void F(MyScanner sc, PrintWriter pw){

    }
    public static void G(MyScanner sc, PrintWriter pw){

    }
    static class MyScanner {
        StringTokenizer st;
        BufferedReader br;

        public MyScanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public MyScanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

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

        public boolean ready() throws IOException {return br.ready();}
    }
}