#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int N = 110000;
int i, j, k, l, K, m, n, o, p, S[N], tot, U[10], V[10], T[N];
inline int sn(double x) { return x < -eps ? -1 : x > eps ? 1 : 0; }
struct arr {
  double A, B, C;
} L[N];
inline void Init() {
  srand(time(0));
  scanf("%d%d", &n, &k);
  int a, b, c;
  for (i = 1; i <= n; i++) {
    scanf("%d%d%d", &a, &b, &c);
    L[i].A = a;
    L[i].B = b;
    L[i].C = c;
    S[++tot] = i;
  }
}
double x, y, k1, k2, d1, d2;
inline int get(int u, int v) {
  double a1, a2, b1, b2, c1, c2;
  a1 = L[u].A;
  b1 = L[u].B;
  c1 = L[u].C;
  a2 = L[v].A;
  b2 = L[v].B;
  c2 = L[v].C;
  if (sn(b1)) {
    k1 = -a1 / b1;
    d1 = -c1 / b1;
    if (sn(b2)) {
      k2 = -a2 / b2;
      d2 = -c2 / b2;
      if (sn(k1 - k2)) {
        x = (d2 - d1) / (k1 - k2);
        y = k1 * x + d1;
      } else
        return 0;
    } else {
      x = (-c2 / a2);
      y = k1 * x + d1;
    }
  } else {
    if (sn(b2)) {
      k2 = -a2 / b2;
      d2 = c2 / b2;
      x = -c1 / a1;
      y = k2 * x + d2;
    } else
      return 0;
  }
  return 1;
}
inline int cul(int u, int v) {
  int i, ans = 0;
  if (get(S[u], S[v])) {
    for (i = 1; i <= tot; i++)
      if (!sn(L[S[i]].A * x + L[S[i]].B * y + L[S[i]].C)) ans++;
    return ans;
  } else
    return 0;
}
inline int Solve() {
  int lst, find;
  K = 0;
  while (tot && (K < k)) {
    lst = tot / (k - K);
    find = 0;
    if (tot > 1) {
      for (i = 1; i <= 50; i++) {
        o = p = 1;
        while (o == p) {
          o = rand() % tot + 1;
          p = rand() % tot + 1;
        }
        if (cul(o, p) >= lst) {
          find = 1;
          break;
        }
      }
      if (!find) break;
      K++;
      U[K] = S[o];
      V[K] = S[p];
      l = 0;
      for (i = 1; i <= tot; i++)
        if (sn(L[S[i]].A * x + L[S[i]].B * y + L[S[i]].C)) {
          l++;
          T[l] = S[i];
        }
      tot = l;
      for (i = 1; i <= tot; i++) S[i] = T[i];
    } else {
      K++;
      V[K] = -1;
      U[K] = S[1];
      tot--;
    }
  }
  if (!tot) return 1;
  if (tot <= k - K) {
    for (i = 1; i <= tot; i++) {
      K++;
      V[K] = -1;
      U[K] = S[i];
    }
    return 1;
  }
  return 0;
}
int main() {
  Init();
  if (Solve()) {
    puts("YES");
    printf("%d\n", K);
    for (i = 1; i <= K; i++) printf("%d %d\n", U[i], V[i]);
  } else
    puts("NO");
  return 0;
}
