#include <bits/stdc++.h>
using namespace std;
const int Maxn = 111000;
int A[Maxn], B[Maxn], C[Maxn], id[Maxn];
int ans[10][2];
int N, K;
bool success;
bool intersect(int id1, int id2, double &sx, double &sy) {
  double dab = (double)A[id1] * B[id2] - (double)A[id2] * B[id1];
  if (fabs(dab) < 1e-7) return false;
  double dac = (double)C[id1] * A[id2] - (double)C[id2] * A[id1];
  double dbc = (double)B[id1] * C[id2] - (double)B[id2] * C[id1];
  sx = dbc / dab;
  sy = dac / dab;
  return true;
}
bool onLine(int id1, double sx, double sy) {
  double d = fabs(A[id1] * sx + B[id1] * sy + C[id1]);
  if (d < 1e-7) return true;
  return fabs(A[id1] * sx + B[id1] * sy + C[id1]) < 1e-7;
}
void dfs(int dep, vector<int> &rest) {
  if (rest.size() <= K - dep) {
    printf("YES\n");
    printf("%d\n", dep + (int)rest.size());
    for (int i = 0; i < dep; ++i)
      printf("%d %d\n", min(ans[i][0], ans[i][1]), max(ans[i][0], ans[i][1]));
    for (int i = 0; i < rest.size(); ++i) printf("%d -1\n", rest[i] + 1);
    success = true;
    return;
  }
  if (dep == K) return;
  vector<int> newRest;
  bool flag = false;
  if (rest.size() > (K - dep) * (K - dep)) {
    int iterate = min(300, 3000000 / (int)rest.size());
    for (int k = 0; k < iterate; ++k) {
      int x = rand() % rest.size();
      int y = rand() % rest.size();
      double sx, sy;
      newRest.clear();
      if (intersect(rest[x], rest[y], sx, sy)) {
        int cnt = 0;
        for (int i = 0; i < rest.size(); ++i)
          if (onLine(rest[i], sx, sy))
            ++cnt;
          else
            newRest.push_back(rest[i]);
        if (cnt > K - dep) {
          ans[dep][0] = rest[x] + 1;
          ans[dep][1] = rest[y] + 1;
          ++dep;
          flag = true;
          break;
        }
      }
    }
    if (!flag) return;
    dfs(dep, newRest);
  } else {
    bool vis[64];
    memset(vis, false, sizeof(vis));
    int l = min(K + 1, (int)rest.size());
    double sx, sy;
    for (int i = 0; i < l; ++i)
      for (int j = i + 1; j < l; ++j) {
        if (intersect(rest[i], rest[j], sx, sy)) {
          int status = 0;
          newRest.clear();
          for (int k = 0; k < l; ++k)
            if (onLine(rest[k], sx, sy)) {
              status |= 1 << k;
            } else
              newRest.push_back(rest[k]);
          if (vis[status]) continue;
          vis[status] = true;
          ans[dep][0] = rest[i] + 1;
          ans[dep][1] = rest[j] + 1;
          for (int k = l; k < rest.size(); ++k)
            if (!onLine(rest[k], sx, sy)) newRest.push_back(rest[k]);
          dfs(dep + 1, newRest);
          if (success) return;
        }
      }
  }
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; ++i) {
    id[i] = i;
    scanf("%d%d%d", &A[i], &B[i], &C[i]);
  }
  vector<int> rest;
  rest.clear();
  for (int i = 0; i < N; ++i) rest.push_back(id[i]);
  srand(time(0));
  success = false;
  dfs(0, rest);
  if (!success) printf("NO\n");
  return 0;
}
