#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
long long calc(long long x, long long y, long long a, long long b) {
  return x * b - a * y;
}
long long calc(long long x, long long y, long long z, long long a, long long b,
               long long c, long long u, long long v, long long w) {
  return x * b * w - u * b * z + y * c * u - v * c * x + z * a * v - w * a * y;
}
int x[N], y[N], z[N];
bool Judge(int i, int j) { return calc(x[i], y[i], x[j], y[j]); }
bool Judge(int i, int j, int k) {
  return calc(x[i], y[i], z[i], x[j], y[j], z[j], x[k], y[k], z[k]);
}
vector<pair<int, int> > ans;
bool solve(vector<int>& val, int k) {
  int n = val.size();
  if (n <= k) {
    for (int i = 0; i <= n - 1; i++) ans.push_back(pair<int, int>(val[i], -1));
    return 1;
  } else if (n <= k * k) {
    for (int i = 0; i <= k; i++)
      for (int j = 0; j <= k; j++)
        if (Judge(val[i], val[j])) {
          vector<int> rec;
          ans.push_back(pair<int, int>(val[i], val[j]));
          for (int _ = 0; _ <= n - 1; _++)
            if (Judge(val[i], val[j], val[_])) {
              rec.push_back(val[_]);
            }
          if (solve(rec, k - 1)) return 1;
          ans.pop_back();
        }
    return 0;
  } else {
    for (int i = 0; i <= k * k; i++)
      for (int j = 0; j <= k * k; j++)
        if (Judge(val[i], val[j])) {
          int cnt = 0;
          for (int _ = 0; _ <= k * k; _++)
            if (!Judge(val[i], val[j], val[_])) cnt++;
          if (cnt > k) {
            vector<int> rec;
            ans.push_back(pair<int, int>(val[i], val[j]));
            for (int _ = 0; _ <= n - 1; _++)
              if (Judge(val[i], val[j], val[_])) {
                rec.push_back(val[_]);
              }
            return solve(rec, k - 1);
          }
        }
    return 0;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d%d%d", x + i, y + i, z + i);
  vector<int> val;
  for (int i = 1; i <= n; i++) val.push_back(i);
  if (solve(val, k)) {
    puts("YES");
    printf("%d\n", ans.size());
    for (int i = 0; i <= (int)ans.size() - 1; i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
  } else {
    puts("NO");
  }
  return 0;
}
