#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;
const long long linf = (1ll << 62) - 1;
const double eps = 1e-9;
const double pi = 4 * atan(1.0);
const int N = 1e5 + 100;
int n, k;
long long a[N], b[N], c[N];
pair<long long, int> inter[N], pinter[N];
int cnt[N];
long long gcd(long long a, long long b) {
  while (b) {
    long long y = a % b;
    a = b;
    b = y;
  }
  return a;
}
inline bool intersect(int f, int s, long long &res) {
  const long long r = 28318237214737ll;
  long long d = a[f] * b[s] - a[s] * b[f];
  if (d == 0) {
    return false;
  }
  long long dx = c[f] * b[s] - c[s] * b[f], dy = a[f] * c[s] - a[s] * c[f];
  if (d < 0) {
    d = -d, dx = -dx, dy = -dy;
  }
  long long g = gcd(gcd(abs(dx), abs(dy)), abs(d));
  d /= g, dx /= g, dy /= g;
  res = ((d * r + dx) * r + dy) * r;
  return true;
}
set<long long> used;
int wh[N];
int myrand() { return abs((int)(((long long)rand()) << 16) ^ rand()); }
double begins = clock();
inline bool solve(vector<int> cur, int k) {
  if ((clock() - begins) / CLOCKS_PER_SEC > 1.9) {
    puts("NO");
    exit(0);
  }
  static const long long r1 = 218321381232747ll;
  if (k < 0) {
    return false;
  }
  if (k >= ((int)(cur).size())) {
    puts("YES");
    k -= ((int)(cur).size());
    printf("%d\n", ::k - k);
    for (int i : cur) {
      printf("%d %d\n", i + 1, -1);
    }
    return true;
  }
  long long hash = 0;
  for (int i : cur) {
    hash = hash * r1 + i + 1;
  }
  if (used.find(hash) != used.end()) {
    return false;
  }
  used.insert(hash);
  for (int it = 0; it < k * 4; it++) {
    int line = myrand() % ((int)(cur).size());
    long long res;
    int interLen = 0;
    for (int i = 0; i < ((int)(cur).size()); i++) {
      if (!intersect(cur[line], cur[i], res)) {
        continue;
      }
      inter[interLen++] = make_pair(res, i);
    }
    sort(inter, inter + interLen);
    int cc = 0;
    fill_n(wh, ((int)(cur).size()), -1);
    for (int i = 0; i < interLen; i++) {
      wh[inter[i].second] = i;
      if (!i || inter[i].first != inter[i - 1].first) {
        cnt[cc] = 1;
        pinter[cc++] = inter[i];
      } else {
        cnt[cc - 1]++;
      }
    }
    for (int i = 0; i < cc; i++) {
      if ((cnt[i] + 1) * k >= ((int)(cur).size())) {
        vector<int> nextToTake;
        for (int j = 0; j < ((int)(cur).size()); j++) {
          if (j != line &&
              (wh[j] == -1 || inter[wh[j]].first != pinter[i].first)) {
            nextToTake.push_back(cur[j]);
          }
        }
        int a = cur[line], b = cur[pinter[i].second];
        if (solve(nextToTake, k - 1)) {
          printf("%d %d\n", a + 1, b + 1);
          return true;
        }
      }
    }
  }
  return false;
}
long long readLong() {
  int x;
  scanf("%d", &x);
  return x;
}
void gen() {
  freopen("D.in", "w", stdout);
  int n = 1e5, k = 5, c = 1000;
  cout << n << " " << k << endl;
  vector<pair<int, int> > pt(k);
  for (int i = 0; i < k; i++) {
    pt[i] = make_pair(myrand() % c, myrand() % c);
  }
  set<pair<pair<int, int>, int> > s;
  for (int i = 0; i < n; i++) {
    int p = rand() % k;
    pair<int, int> pt2;
    for (;;) {
      pt2 = make_pair(myrand() % c, myrand() % c);
      ;
      if (pt[p] != pt2) {
        int a = pt2.second - pt[p].second, b = pt[p].first - pt2.first,
            c = -(pt2.first * a + pt2.second * b);
        if (a < 0 || (a == 0 && b < 0)) {
          a = -a, b = -b, c = -c;
        }
        int d = gcd(a, b);
        a /= d, b /= d, c /= d;
        if (s.find(make_pair(make_pair(a, b), c)) != s.end()) {
          continue;
        }
        printf("%d %d %d\n", a, b, c);
        s.insert(make_pair(make_pair(a, b), c));
        break;
      }
    }
  }
  exit(0);
}
int main() {
  srand(time(NULL));
  double begin = clock();
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    a[i] = readLong();
    b[i] = readLong();
    c[i] = -readLong();
  }
  vector<int> cur(n);
  for (int i = 0; i < n; i++) {
    cur[i] = i;
  }
  if (!solve(cur, k)) {
    puts("NO");
  }
  42;
  return 0;
}
