#include <bits/stdc++.h>
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return a > b ? a = b, true : false;
}
template <typename T>
T read(T &first) {
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (first = 0; isdigit(ch); ch = getchar()) first = 10 * first + ch - '0';
  return first *= f;
}
template <typename T>
void write(T first) {
  if (first < 0) {
    putchar('-');
    first = -first;
  }
  static char s[20];
  int top = 0;
  for (; first; first /= 10) s[++top] = first % 10 + '0';
  if (top == 0)
    putchar('0');
  else
    while (top) putchar(s[top--]);
}
const int MAXN = 1e5 + 5, MAXK = 6;
struct Line {
  int a, b, c;
  int id;
  bool on(const std::pair<double, double> &p) {
    static double EPS = 1e-8;
    return std::fabs(a * p.first + b * p.second + c) < EPS;
  }
};
int N, K;
Line A[MAXN];
std::pair<int, int> ans[MAXN];
int anssize;
int st[MAXN];
inline bool intersection(const Line &a, const Line &b,
                         std::pair<double, double> &p) {
  long long d = (long long)a.b * b.a - (long long)b.b * a.a;
  if (d == 0) return false;
  p.first = (double)((long long)b.b * a.c - (long long)a.b * b.c) / d;
  p.second = (double)((long long)b.c * a.a - (long long)a.c * b.a) / d;
  return true;
}
bool dfs(int n, int k) {
  if (n <= k) {
    for (int i = 0; i < n; ++i) {
      ans[anssize++] = std::make_pair(A[i].id + 1, -1);
    }
    return true;
  }
  if (k == 0) return false;
  for (int i = n - k - 1; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      std::pair<double, double> p;
      if (intersection(A[i], A[j], p) == false) continue;
      ans[anssize++] = std::make_pair(A[i].id + 1, A[j].id + 1);
      int m = n, top = 0;
      for (int k = n - 1; k >= 0; --k) {
        if (A[k].on(p)) {
          st[++top] = k;
          std::swap(A[k], A[--m]);
        }
      }
      if (dfs(m, k - 1) == true) return true;
      --anssize;
      while (top > 0) {
        std::swap(A[st[top--]], A[m++]);
      }
    }
  }
  return false;
}
void input() {
  read(N);
  read(K);
  for (int i = 0; i < N; ++i) {
    read(A[i].a);
    read(A[i].b);
    read(A[i].c);
    A[i].id = i;
  }
}
void solve() {
  srand(time(NULL));
  if (N >= K * K * K) {
    int times = 100;
    while (times-- && N > 0 && K > 0) {
      int i = rand() % N;
      int j = rand() % N;
      std::pair<double, double> p;
      if (i == j || intersection(A[i], A[j], p) == false) continue;
      int top = 0;
      for (int k = N - 1; k >= 0; --k) {
        if (A[k].on(p)) st[++top] = k;
      }
      if (top > K) {
        ans[anssize++] = std::make_pair(A[i].id + 1, A[j].id + 1);
        for (int k = 1; k <= top; ++k) {
          A[st[k]] = A[--N];
        }
        --K;
      }
    }
  }
  bool haveAns = dfs(N, K);
  if (haveAns) {
    puts("YES");
    write(anssize);
    putchar('\n');
    for (int i = 0; i < anssize; ++i) {
      write(ans[i].first);
      putchar(' ');
      write(ans[i].second);
      putchar('\n');
    }
  } else
    puts("NO");
}
int main() {
  input();
  solve();
  return 0;
}
