#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
char ch[4000010];
inline string get() {
  scanf("%s", ch);
  return string(ch);
}
inline void read(long long *a, long long n) {
  for (long long i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
template <class blank, class blank2>
inline void smin(blank &a, blank2 b) {
  a = a <= b ? a : b;
}
template <class blank, class blank2>
inline void smax(blank &a, blank2 b) {
  a = a >= b ? a : b;
}
const long long maxn = 1e5 + 10;
const long long maxm = 4e6 + 10;
const long long maxlg = 20;
const long long base = 29;
const long long mod = 1e9 + 7;
const long long inf = 2e18 + 10;
const double eps = 1e-4;
long long a[maxn], b[maxn], c[maxn];
pair<long long, long long> q[maxn];
long long t = 0;
inline bool hamShib(long long i, long long j) {
  return 1LL * a[i] * b[j] == 1LL * a[j] * b[i];
}
inline bool check(long long t, long long f, long long s) {
  return abs((double)(1LL * b[s] * a[t] - 1LL * a[s] * b[t]) *
                 (1LL * b[s] * c[f] - 1LL * b[f] * c[s]) -
             (double)(1LL * b[f] * a[s] - 1LL * a[f] * b[s]) *
                 (1LL * b[t] * c[s] - 1LL * b[s] * c[t])) > 0.1;
}
inline bool back_track(long long rem, vector<long long> &lines) {
  long long n = (long long)lines.size();
  if (n <= rem) {
    for (long long i = 0; i < n; i++) q[t++] = {lines[i] + 1, -1};
    return true;
  }
  if (!rem) return false;
  if (n >= 30 * rem * rem)
    for (long long _ = 0; _ < 100; _++) {
      long long f = rand() % n;
      long long s = rand() % (n - 1);
      if (s == f) s++;
      if (1LL * a[lines[f]] * b[lines[s]] == 1LL * a[lines[s]] * b[lines[f]])
        continue;
      q[t++] = {lines[f] + 1, lines[s] + 1};
      vector<long long> vc2;
      for (long long pt = 0; pt < n; pt++) {
        if (pt == f || pt == s) continue;
        if (check(lines[pt], lines[f], lines[s]) ||
            check(lines[pt], lines[s], lines[f]) ||
            hamShib(lines[pt], lines[f]) || hamShib(lines[pt], lines[s]))
          vc2.push_back(lines[pt]);
      }
      if (vc2.size() <= n - rem - 1) {
        long long val = back_track(rem - 1, vc2);
        if (val) return true;
        --t;
        return false;
      } else
        t--;
    }
  else {
    for (long long f = 0; f <= rem; f++)
      for (long long s = f + 1; s <= rem; s++) {
        if (1LL * a[lines[f]] * b[lines[s]] == 1LL * a[lines[s]] * b[lines[f]])
          continue;
        q[t++] = {lines[f] + 1, lines[s] + 1};
        vector<long long> vc2;
        for (long long pt = 0; pt < n; pt++) {
          if (pt == f || pt == s) continue;
          if (check(lines[pt], lines[f], lines[s]) ||
              check(lines[pt], lines[s], lines[f]) ||
              hamShib(lines[pt], lines[f]) || hamShib(lines[pt], lines[s]))
            vc2.push_back(lines[pt]);
        }
        long long val = back_track(rem - 1, vc2);
        if (val) return true;
        --t;
      }
  }
  return false;
}
int32_t main() {
  long long n = in(), k = in();
  vector<long long> lines;
  for (long long i = 0; i < n; i++)
    a[i] = in(), b[i] = in(), c[i] = in(), lines.push_back(i);
  bool res = back_track(k, lines);
  if (!res) out("NO");
  printf("YES\n");
  printf("%lld\n", t);
  for (long long i = 0; i < t; i++)
    printf("%lld %lld\n", q[i].first, q[i].second);
}
