#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmin(T &a, T b) {
  return a > b ? a = b, true : false;
}
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
const int maxN = 1e5 + 5;
const double eps = 1e-9;
bool dcmp(double x) {
  if (fabs(x) < eps) return 0;
  return x > 0 ? 1 : -1;
}
struct Line {
  double a, b, c;
  Line() {}
  Line(double a, double b, double c) : a(a), b(b), c(c) {}
} l[maxN];
pair<double, double> GetInsection(Line a, Line b) {
  double retx = .0, rety = .0;
  if ((a.a == 0 && b.a == 0) || (a.b == 0 && b.b == 0))
    return make_pair(1e30, 1e30);
  if (b.a == 0 || b.b == 0) swap(a, b);
  if (a.a == 0) {
    rety = a.c / a.b;
    retx = (b.c - b.b * rety) / b.a;
    return make_pair(retx, rety);
  } else if (a.b == 0) {
    retx = a.c / a.a;
    rety = (b.c - b.a * retx) / b.b;
    return make_pair(retx, rety);
  } else {
    double A = a.a / a.b - b.a / b.b;
    if (dcmp(A) == 0)
      return make_pair(1e30, 1e30);
    else {
      retx = -(a.c / a.b - b.c / b.b) / A;
      rety = -(a.c / a.a - b.c / b.a) / (a.b / a.a - b.b / b.a);
      return make_pair(retx, rety);
    }
  }
}
bool OnLine(pair<double, double> a, Line b) {
  return dcmp(b.a * a.first + b.b * a.second + b.c) == 0;
}
int N, K;
bool Covered[maxN];
pair<int, int> ans[10];
int main() {
  srand(time(0));
  scanf("%d%d", &N, &K);
  for (int i = (1), _end = (N); i <= _end; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    l[i] = Line(a, b, c);
  }
  int R = N, T = 0;
  bool Ok = false;
  for (int i = (1), _end = (K); i <= _end; ++i) {
    bool flag = false;
    int l1 = 0, l2 = 0;
    T = i;
    for (int j = (1), _end = (300); j <= _end; ++j) {
      int u = rand() % N + 1;
      int v = rand() % N + 1;
      for (int t = 1; t <= 10 && u == v;
           u = rand() % N + 1, v = rand() % N + 1, t++) {
      }
      pair<double, double> Ins = GetInsection(l[u], l[v]);
      if (Ins.first == 1e30) continue;
      int cnt = 0;
      for (int k = (1), _end = (N); k <= _end; ++k) {
        if (Covered[k] == false && OnLine(Ins, l[k])) {
          cnt++;
          if (cnt * (K - i + 1) >= R) {
            flag = true;
            l1 = u;
            l2 = v;
            goto pos1;
          }
        }
      }
    }
  pos1:
    if (flag == false) {
      if ((K - i + 1) >= R) {
        ans[i].second = -1;
        for (int j = (1), _end = (N); j <= _end; ++j)
          if (Covered[j] == false) {
            ans[i].first = j;
            break;
          }
        R--;
        if (R == 0) {
          Ok = true;
          goto pos;
        }
        continue;
      } else {
        puts("NO");
        return 0;
      }
    } else {
      pair<double, double> Ins = GetInsection(l[l1], l[l2]);
      int cnt = 0;
      for (int j = (1), _end = (N); j <= _end; ++j)
        if (OnLine(Ins, l[j])) {
          cnt += Covered[j] == false;
          Covered[j] = true;
        }
      ans[i] = make_pair(l1, l2);
      R -= cnt;
      if (R == 0) {
        Ok = true;
        goto pos;
      }
    }
  }
pos:
  if (Ok) {
    puts("YES");
    printf("%d\n", T);
    for (int i = (1), _end = (T); i <= _end; ++i)
      printf("%d %d\n", ans[i].first, ans[i].second);
  } else
    puts("NO");
  return 0;
}
