#include <bits/stdc++.h>   using namespace std;   const int n = 100000, i = 700;   long long a[n], s[n], d[n], h[1000];   long long *g1, *g2, *g3, *g4;   int *g5, *g6, *g9;   int my, ans = 0, a1[n], h1[6], h2[6];   long long gcd(long long e, long long r) {     if (e < 0) e = -e;     while ((e) && (r))       if (e > r)         e %= r;       else         r %= e;     return e + r;   }   void getxy(long long ae, long long se, long long de, long long ar, long long sr,              long long dr, long long &f1, long long &f2, long long &f3,              long long &f4) {     f1 = dr * se - de * sr;     f2 = ae * sr - ar * se;     if (f2 < 0) {       f1 = -f1;       f2 = -f2;     }     if (f2 == 0) return;     long long c = gcd(f1, f2);     f1 /= c;     f2 /= c;     if (se) {       f3 = -ae * f1 - de * f2;       f4 = f2 * se;     } else {       f3 = -ar * f1 - dr * f2;       f4 = f2 * sr;     }     if (f4 < 0) {       f3 = -f3;       f4 = -f4;     }     c = gcd(f3, f4);     f3 /= c;     f4 /= c;   }   int cmp(int e, long long g1r, long long g2r, long long g3r, long long g4r) {     if (g1[e] < g1r) return 0;     if (g1[e] > g1r) return 2;     if (g2[e] < g2r) return 0;     if (g2[e] > g2r) return 2;     if (g3[e] < g3r) return 0;     if (g3[e] > g3r) return 2;     if (g4[e] < g4r) return 0;     if (g4[e] > g4r) return 2;     return 1;   }   void qs(int q, int w) {     int e = q, r = w;     long long y = q + (rand() % (w - q + 1)), t1 = g1[y], t2 = g2[y], t3 = g3[y],               t4 = g4[y];     do {       while (cmp(e, t1, t2, t3, t4) == 0) e++;       while (cmp(r, t1, t2, t3, t4) == 2) r--;       if (e <= r) {         y = g1[e];         g1[e] = g1[r];         g1[r] = y;         y = g2[e];         g2[e] = g2[r];         g2[r] = y;         y = g3[e];         g3[e] = g3[r];         g3[r] = y;         y = g4[e];         g4[e] = g4[r];         g4[r] = y;         y = g5[e];         g5[e] = g5[r];         g5[r] = y;         y = g6[e];         g6[e] = g6[r];         g6[r] = y;         e++;         r--;       }     } while (e <= r);     if (q < r) qs(q, r);     if (e < w) qs(e, w);   }   void qs1(int q, int w) {     int e = q, r = w;     long long y = q + (rand() % (w - q + 1)), t = g9[y];     do {       while (g9[e] > t) e++;       while (g9[r] < t) r--;       if (e <= r) {         y = g1[e];         g1[e] = g1[r];         g1[r] = y;         y = g2[e];         g2[e] = g2[r];         g2[r] = y;         y = g3[e];         g3[e] = g3[r];         g3[r] = y;         y = g4[e];         g4[e] = g4[r];         g4[r] = y;         y = g5[e];         g5[e] = g5[r];         g5[r] = y;         y = g6[e];         g6[e] = g6[r];         g6[r] = y;         y = g9[e];         g9[e] = g9[r];         g9[r] = y;         e++;         r--;       }     } while (e <= r);     if (q < r) qs1(q, r);     if (e < w) qs1(e, w);   }   void del(int &q, long long *a, long long *s, long long *d, int *a1,            long long f1, long long f2, long long f3, long long f4, int v1, int v2,            int v3) {     int w, t = 0;     long long c1, c2, c3, c4;     for (w = 0; w < q; w++) {       if ((a[w] == v1) && ((s[w] == v2) && (d[w] == v3))) continue;       getxy(a[w], s[w], d[w], v1, v2, v3, c1, c2, c3, c4);       if (((c1 == f1) && (c2 == f2)) && ((c3 == f3) && (c4 == f4))) continue;       a[t] = a[w];       s[t] = s[w];       d[t] = d[w];       a1[t] = a1[w];       t++;     }     q = t;   }   bool poss(int q, int r, int t, int y, int *a) {     int w, e = 0;     for (w = 0; w < y; w++)       if (r + w < t) e += a[r + w];     if (e >= q) return 1;     return 0;   }   long long impos = 0, impos1[i], impos2[i], impos3[i], impos4[i];   bool schim(long long c1, long long c2, long long c3, long long c4) {     int w;     for (w = 0; w < impos; w++)       if (((impos1[w] == c1) && (impos2[w] == c2)) &&           ((impos3[w] == c3) && (impos4[w] == c4)))         return 0;     return 1;   }   void addim(int c1, int c2, int c3, int c4) {     impos1[impos] = c1;     impos2[impos] = c2;     impos3[impos] = c3;     impos4[impos] = c4;     impos++;   }   bool slv(int q, int y, long long *a, long long *s, long long *d, int *a1,            bool b) {     if (q == 0) return 1;     if (y == 0) return 0;     int w, e, r, t, u, f5[i], f6[i], f9[i];     long long f1[i], f2[i], f3[i], f4[i];     u = my * my + 1;     if (b) u = q;     t = 0;     for (w = 0; (w < u) && (w < q); w++)       for (e = w + 1; (e < u) && (e < q); e++) {         getxy(a[w], s[w], d[w], a[e], s[e], d[e], f1[t], f2[t], f3[t], f4[t]);         f5[t] = w;         f6[t] = e;         if (f2[t]) t++;       }     g1 = f1;     g2 = f2;     g3 = f3;     g4 = f4;     g5 = f5;     g6 = f6;     if (t) qs(0, t - 1);     if (t == 0) {       if (q > y) return 0;       for (w = 0; w < q; w++) {         h1[ans] = a1[w] + 1;         h2[ans] = -1;         ans++;       }       return 1;     }     r = 0;     for (w = 0; w < t;) {       f1[r] = f1[w];       f2[r] = f2[w];       f3[r] = f3[w];       f4[r] = f4[w];       f5[r] = f5[w];       f6[r] = f6[w];       f9[r] = 1;       for (e = w + 1; (e < t) && (((f1[w] == f1[e]) && (f2[w] == f2[e])) &&                                   ((f3[w] == f3[e]) && (f4[w] == f4[e])));            e++)         f9[r]++;       f9[r] = h[f9[r]];       r++;       w = e;     }     g9 = f9;     t = r;     qs1(0, t - 1);     long long aa[q], ss[q], dd[q];     int aa1[q];     for (w = 0; w < q; w++) {       aa[w] = a[w];       ss[w] = s[w];       dd[w] = d[w];       aa1[w] = a1[w];     }     if (g9[0] > my) {       r = g5[0];       h1[ans] = a1[g5[0]] + 1;       h2[ans] = a1[g6[0]] + 1;       ans++;       del(q, aa, ss, dd, aa1, f1[0], f2[0], f3[0], f4[0], a[r], s[r], d[r]);       y--;       return slv(q, y, aa, ss, dd, aa1, 0);     }     int q1, im0 = impos;     for (w = 0; w < t; w++)       if ((poss(q, w, t, y, f9)) && (schim(f1[w], f2[w], f3[w], f4[w]))) {         r = f5[w];         h1[ans] = a1[f5[w]] + 1;         h2[ans] = a1[f6[w]] + 1;         ans++;         for (e = 0; e < q; e++) {           aa[e] = a[e];           ss[e] = s[e];           dd[e] = d[e];           aa1[e] = a1[e];         }         q1 = q;         del(q1, aa, ss, dd, aa1, f1[w], f2[w], f3[w], f4[w], a[r], s[r], d[r]);         if (slv(q1, y - 1, aa, ss, dd, aa1, 1)) return 1;         ans--;         addim(f1[w], f2[w], f3[w], f4[w]);       }     impos = im0;     return 0;   }   int main() {     int q, q1, w, e, r, r1, r2, r3, t, y, u, max1, max2;     for (w = 1; w <= 26; w++) h[w * (w - 1) / 2] = w;     cin >> q >> y;     my = y;     for (w = 0; w < q; w++) {       scanf( %I64d%I64d%I64d , &a[w], &s[w], &d[w]);       a1[w] = w;     }     if (!slv(q, y, a, s, d, a1, 0))       cout <<  NO ;     else {       cout <<  YES n  << ans <<   n ;       for (w = 0; w < ans; w++) cout << h1[w] <<     << h2[w] <<   n ;     }     return 0;   }