#include <bits/stdc++.h>
using namespace std;
struct Line {
  int x, y, z, id;
};
vector<pair<int, int> > ans;
int n, k, x, y, z;
vector<Line> L;
long long det(Line a, Line b) { return 1ll * a.y * b.x - 1ll * a.x * b.y; }
long long chk(Line a, Line b, Line c) {
  long long p = 1ll * b.y * c.z - 1ll * b.z * c.y;
  long long q = 1ll * b.x * c.z - 1ll * b.z * c.x;
  long long r = 1ll * b.x * c.y - 1ll * b.y * c.x;
  return a.x * p - a.y * q + a.z * r;
}
void solve(vector<Line> &L, int k) {
  int n = L.size();
  if (n <= k) {
    printf("YES\n%d\n", n + ans.size());
    for (int i = 0; i < n; i++) printf("%d -1\n", L[i].id);
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
    exit(0);
  }
  if (!k) return;
  vector<Line> cur;
  for (int i = 3 * k * k; i; i--) {
    int x = rand() % n, y = rand() % n;
    for (; y == x; y = rand() % n)
      ;
    Line a = L[x], b = L[y];
    if (!det(a, b)) continue;
    cur.clear();
    for (int j = 0; j < n; j++)
      if (j != x && j != y && chk(a, b, L[j])) cur.push_back(L[j]);
    int t = n - cur.size();
    if (cur.size() > max(k - 1, n - n / k)) continue;
    ans.push_back(pair<int, int>(a.id, b.id));
    solve(cur, k - 1);
    ans.pop_back();
    if (t > k) return;
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x, &y, &z);
    L.push_back((Line){x, y, z, i});
  }
  solve(L, k);
  puts("NO");
}
