#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > seq;
const int mod = 1e6;
const long long A = 42344;
const long long B = 333;
int seed = 239;
int mrand() {
  static int now = -1;
  if (now == -1)
    now = seed;
  else
    now = (A * now + B) % mod;
  return now;
}
struct line {
  long long a, b, c;
  int id;
  line() {}
  line(long long A, long long B, long long C, int i)
      : a(A), b(B), c(C), id(i) {}
};
void run(vector<line> a, int k) {
  int n = (int)a.size();
  if (k >= n) {
    for (int i = 0; i < n; i++) seq.push_back(make_pair(a[i].id, -1));
    sort(seq.begin(), seq.end());
    seq.resize(unique(seq.begin(), seq.end()) - seq.begin());
    puts("YES");
    printf("%d\n", (int)seq.size());
    for (int i = 0; i < (int)seq.size(); i++)
      printf("%d %d\n", seq[i].first, seq[i].second);
    exit(0);
  }
  if (k == 0) return;
  vector<line> go;
  for (int iter = 0; iter < k * k; iter++) {
    int i = mrand() % n, j = mrand() % (n - 1);
    if (j >= i) j++;
    if (a[i].a * a[j].b == a[j].a * a[i].b) continue;
    go.resize(0);
    int kol = 0;
    double lim = max(1.0 * kol, n * (1.0 - 1.0 / (2.0 * k)));
    for (int q = 0; q < n; q++)
      if (a[i].a * a[j].b * a[q].c + a[i].b * a[j].c * a[q].a +
              a[i].c * a[j].a * a[q].b !=
          a[i].c * a[j].b * a[q].a + a[i].b * a[j].a * a[q].c +
              a[i].a * a[j].c * a[q].b) {
        go.push_back(a[q]);
        kol++;
        if (kol > lim) break;
      }
    if (kol > lim) continue;
    seq.push_back(make_pair(a[i].id, a[j].id));
    run(go, k - 1);
    seq.pop_back();
  }
}
int main() {
  srand(123654);
  int n, k;
  scanf("%d%d", &n, &k);
  vector<line> l(n);
  for (int i = 0; i < n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    l[i] = line(a, b, c, i + 1);
  }
  run(l, k);
  puts("NO");
  return 0;
}
