#include <bits/stdc++.h>
using namespace std;
const int NN = 100011;
const double eps = 1e-8;
int n, k;
struct line {
  int a, b, c;
  line(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
  void input() { scanf("%d %d %d", &a, &b, &c); }
} line[NN];
int vst[NN];
struct point {
  double first, second;
  point(double first = 0, double second = 0) : first(first), second(second) {}
  point operator-(point a) { return point(first - a.first, second - a.second); }
  point operator+(point a) { return point(first + a.first, second + a.second); }
  point operator*(double a) { return point(first * a, second * a); }
  point operator/(double a) { return point(first / a, second / a); }
  point operator&(point a) {
    return point(first * a.first - second * a.second,
                 first * a.second + second * a.first);
  }
  point rotate(double al) { return *this & point(cos(al), sin(al)); }
  double operator^(point a) { return first * a.second - second * a.first; }
  double operator*(point a) { return first * a.first + second * a.second; }
  point norm() {
    double s = nor();
    if (s < eps) return *this;
    return point(first / s, second / s);
  }
  point conj() { return point(-second, first); }
  double nor() { return sqrt(*this * *this); }
  double al() { return atan2(second, first); }
  bool operator<(const point &a) const {
    if (fabs(first - a.first) > eps) return first < a.first;
    return second < a.second - eps;
  }
  bool operator>(const point &a) const {
    if (fabs(first - a.first) > eps) return first > a.first;
    return second > a.second + eps;
  }
  bool operator==(const point &a) const {
    if (fabs(first - a.first) > eps) return 0;
    return fabs(second - a.second) < eps;
  }
  void input() { scanf("%lf %lf", &first, &second); }
  void print() { printf("%lf %lf\n", first, second); }
  int sgn(double a) { return (a > eps) - (a < -eps); }
  bool intersect(point a, point b, point c, point d) {
    if (min(a.first, b.first) > max(c.first, d.first) + eps) return 0;
    if (min(a.second, b.second) > max(c.second, d.second) + eps) return 0;
    if (max(a.first, b.first) < min(c.first, d.first) - eps) return 0;
    if (max(a.second, b.second) < min(c.second, d.second) - eps) return 0;
    if (sgn(a - b ^ c - b) * sgn(a - b ^ d - b) > 0) return 0;
    if (sgn(c - d ^ a - d) * sgn(c - d ^ b - d) > 0) return 0;
    return 1;
  }
};
map<point, int> mp;
vector<pair<int, int> > ans;
point s;
bool intersect(int u, int v) {
  double A = point(line[u].a, line[u].b) ^ point(line[v].a, line[v].b);
  if (abs(A) < eps) return false;
  double B = point(-line[u].c, line[u].b) ^ point(-line[v].c, line[v].b);
  double C = point(line[u].a, -line[u].c) ^ point(line[v].a, -line[v].c);
  s = point(B / A, C / A);
  return true;
}
inline void update(int u) {
  mp.clear();
  int mx = 0;
  int v = -1;
  point p;
  for (int i = 1; i <= n; i++)
    if (!vst[i] and intersect(u, i)) {
      if (++mp[s] > mx) {
        mx = mp[s];
        v = i;
        p = s;
      }
    }
  ans.push_back({u, v});
  for (int i = 1; i <= n; i++)
    if (!vst[i] and intersect(u, i) and p == s) {
      vst[i] = 1;
    }
}
int solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) line[i].input();
  while (k--) {
    for (int i = 1; i <= n; i++)
      if (vst[i] == 0) {
        vst[i] = 1, update(i);
        break;
      }
  }
  for (int i = 1; i <= n; i++)
    if (vst[i] == 0) return puts("NO");
  puts("YES");
  cout << ((int)ans.size()) << endl;
  for (auto r : ans) cout << r.first << ' ' << r.second << endl;
}
int main() {
  solve();
  return 0;
}
