#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int k = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    k = k * 10 + ch - '0';
    ch = getchar();
  }
  return k * f;
}
struct ppap {
  int a, b, c;
} a[100010];
int n, m, ans1[1010], ans2[1010], p[100010];
inline long long cal(ppap &a, ppap &b, ppap &c) {
  return (long long)(a.a) * (b.b) * (c.c) + (long long)(a.b) * (b.c) * (c.a) +
         (long long)(a.c) * (b.a) * (c.b);
}
inline void dfs(int n, int k) {
  if (n <= m - k) {
    puts("YES");
    printf("%d\n", k + n);
    for (int i = 1; i <= k; i++) {
      if (ans1[i] > ans2[i]) swap(ans1[i], ans2[i]);
      printf("%d %d\n", ans1[i], ans2[i]);
    }
    for (int i = 1; i <= n; i++) printf("%d -1\n", p[i]);
    exit(0);
  }
  if (k == m) return;
  int q[100010];
  memcpy(q, p, 4 * (n + 1));
  for (int rp = (m - k) * (m - k); rp--;) {
    int x = rand() % n + 1, y = rand() % n + 1, sum = 0;
    if (x == y) y++;
    x = q[x];
    y = q[y];
    if ((long long)a[x].a * a[y].b == (long long)a[y].a * a[x].b) continue;
    for (int i = 1; i <= n; i++) {
      if (cal(a[x], a[y], a[q[i]]) != cal(a[x], a[q[i]], a[y])) p[++sum] = q[i];
    }
    if (sum > max((double)(m - k - 1), n * (1 - 1.0 / (2 * (double)(m - k)))))
      continue;
    ans1[k + 1] = x;
    ans2[k + 1] = y;
    dfs(sum, k + 1);
  }
}
signed main() {
  srand(526826363);
  n = read();
  m = read();
  for (int i = 1; i <= n; i++)
    p[i] = i, a[i].a = read(), a[i].b = read(), a[i].c = read();
  dfs(n, 0);
  puts("NO");
  return 0;
}
