#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct xxx {
  int x, y, c, id;
};
vector<xxx> a;
int n, m;
vector<pair<int, int> > ans;
inline long long cal(int a, int b, int c, int d) {
  return (long long)a * d - (long long)b * c;
}
inline long long det(const xxx &a, const xxx &b, const xxx &c) {
  long long p = (long long)b.y * c.c - (long long)b.c * c.y;
  long long q = (long long)b.x * c.c - (long long)b.c * c.x;
  long long r = (long long)b.x * c.y - (long long)b.y * c.x;
  return a.x * p - a.y * q + a.c * r;
}
void work(vector<xxx> &a, int k) {
  int n = a.size();
  if (n <= k) {
    printf("YES\n");
    printf("%d\n", ans.size() + n);
    for (int i = 0; i < n; i++) {
      printf("%d -1\n", a[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<xxx> aa;
  for (int i = 3 * k * k; i; i--) {
    int x = rand() % n, y = rand() % n;
    while (y == x) y = rand() % n;
    if (x > y) swap(x, y);
    const xxx &A = a[x], &B = a[y];
    if (!cal(A.x, A.y, B.x, B.y)) continue;
    aa.clear();
    for (int i = 0; i < n; i++) {
      if (i != x && i != y && det(A, B, a[i])) aa.push_back(a[i]);
    }
    int t = aa.size();
    if (t > max(k - 1, n - n / k)) continue;
    ans.push_back(make_pair(a[x].id, a[y].id));
    work(aa, k - 1);
    ans.pop_back();
    if (n - t > k) return;
  }
}
int main() {
  srand(time(NULL));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    xxx x;
    scanf("%d%d%d", &x.x, &x.y, &x.c);
    x.id = i;
    a.push_back(x);
  }
  work(a, m);
  printf("NO");
  return 0;
}
