using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Sign_Posts
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var a = new long[n];
            var b = new long[n];
            var c = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Next();
                b[i] = Next();
                c[i] = Next();
            }

            var remain = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                remain.Add(i);
            }

            var result = new List<Tuple<int, int>>();

            for (int kk = 0; kk < k; kk++)
            {
                if (remain.Count < 2)
                {
                    if (remain.Count == 1)
                    {
                        result.Add(new Tuple<int, int>(remain[0], -2));
                    }
                    remain.Clear();
                    break;
                }

                int max = Math.Min(remain.Count, 100);

                var list = new List<Point>();
                for (int ii = 0; ii < max; ii++)
                {
                    int i = remain[ii];
                    for (int jj = ii + 1; jj < max; jj++)
                    {
                        int j = remain[jj];
                        long l1 = a[i]*b[j] - a[j]*b[i];
                        if (l1 == 0)
                            continue;

                        long r1 = c[i]*b[j] - c[j]*b[i];
                        long r2 = c[i]*a[j] - c[j]*a[i];

                        list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));
                    }
                }

                if (list.Count == 0)
                {
                    result.Add(new Tuple<int, int>(remain[remain.Count - 1], -2));
                    remain.RemoveAt(remain.Count - 1);
                }
                else
                {
                    max = 0;

                    list.Sort(list[0]);

                    int count = 1;
                    int mc = 1;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Compare(list[i], list[i - 1]) == 0)
                        {
                            count++;
                        }
                        else
                        {
                            if (count > mc)
                            {
                                mc = count;
                                max = i - 1;
                            }
                            count = 1;
                        }
                    }

                    result.Add(new Tuple<int, int>(list[max]._i1, list[max]._i2));
                    var remain1 = new List<int>(n);

                    foreach (int i in remain)
                    {
                        if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)
                        {
                            remain1.Add(i);
                        }
                    }

                    remain = remain1;
                }
            }

            if (remain.Count != 0)
            {
                writer.WriteLine("NO");
            }
            else
            {
                writer.WriteLine("YES");
                writer.WriteLine(result.Count);

                foreach (var tuple in result)
                {
                    writer.Write(tuple.Item1 + 1);
                    writer.Write(' ');
                    writer.WriteLine(tuple.Item2 + 1);
                }
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            int m = 1;
            do
            {
                c = reader.Read();
                if (c == '-')
                    m = -1;
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }

        #region Nested type: Point

        private class Point : IComparer<Point>
        {
            public readonly int _i1;
            public readonly int _i2;
            public readonly Rational x;
            public readonly Rational y;

            public Point(Rational x, Rational y, int i1, int i2)
            {
                this.x = x;
                this.y = y;
                _i1 = i1;
                _i2 = i2;
            }

            #region IComparer<Point> Members

            public int Compare(Point x, Point y)
            {
                int c = x.x.Compare(x.x, y.x);
                if (c == 0)
                    c = x.x.Compare(x.y, y.y);
                return c;
            }

            #endregion
        }

        #endregion

        #region Nested type: Rational

        private class Rational : IComparer<Rational>
        {
            public readonly long p;
            public readonly long q;

            public Rational(long p, long q)
            {
                long g = gcd(p, q);
                this.p = p/g;
                this.q = q/g;
            }

            #region IComparer<Rational> Members

            public int Compare(Rational x, Rational y)
            {
                return (x.p*y.q).CompareTo(x.q*y.p);
            }

            #endregion

            private long gcd(long a, long b)
            {
                if (b == 0)
                    return a;
                return gcd(b, a%b);
            }
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Sign_Posts
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var a = new long[n];
            var b = new long[n];
            var c = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Next();
                b[i] = Next();
                c[i] = Next();
            }

            var remain = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                remain.Add(i);
            }

            var result = new List<Tuple<int, int>>();

            for (int kk = 0; kk < k; kk++)
            {
                if (remain.Count < 2)
                {
                    if (remain.Count == 1)
                    {
                        result.Add(new Tuple<int, int>(remain[0], -2));
                    }
                    remain.Clear();
                    break;
                }

                int max = Math.Min(remain.Count, 30);

                var list = new List<Point>();
                for (int ii = 0; ii < max; ii++)
                {
                    int i = remain[ii];
                    for (int jj = ii + 1; jj < max; jj++)
                    {
                        int j = remain[jj];
                        long l1 = a[i]*b[j] - a[j]*b[i];
                        if (l1 == 0)
                            continue;

                        long r1 = c[i]*b[j] - c[j]*b[i];
                        long r2 = c[i]*a[j] - c[j]*a[i];

                        list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));
                    }
                }

                if (list.Count == 0)
                {
                    result.Add(new Tuple<int, int>(remain[remain.Count - 1], -2));
                    remain.RemoveAt(remain.Count - 1);
                }
                else
                {
                    max = 0;

                    list.Sort(list[0]);

                    int count = 1;
                    int mc = 1;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Compare(list[i], list[i - 1]) == 0)
                        {
                            count++;
                        }
                        else
                        {
                            if (count > mc)
                            {
                                mc = count;
                                max = i - 1;
                            }
                            count = 1;
                        }
                    }

                    result.Add(new Tuple<int, int>(list[max]._i1, list[max]._i2));
                    var remain1 = new List<int>(n);

                    foreach (int i in remain)
                    {
                        if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)
                        {
                            remain1.Add(i);
                        }
                    }

                    remain = remain1;
                }
            }

            if (remain.Count != 0)
            {
                writer.WriteLine("NO");
            }
            else
            {
                writer.WriteLine("YES");
                writer.WriteLine(result.Count);

                foreach (var tuple in result)
                {
                    writer.Write(tuple.Item1 + 1);
                    writer.Write(' ');
                    writer.WriteLine(tuple.Item2 + 1);
                }
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            int m = 1;
            do
            {
                c = reader.Read();
                if (c == '-')
                    m = -1;
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }

        #region Nested type: Point

        private class Point : IComparer<Point>
        {
            public readonly int _i1;
            public readonly int _i2;
            public readonly Rational x;
            public readonly Rational y;

            public Point(Rational x, Rational y, int i1, int i2)
            {
                this.x = x;
                this.y = y;
                _i1 = i1;
                _i2 = i2;
            }

            #region IComparer<Point> Members

            public int Compare(Point x, Point y)
            {
                int c = x.x.Compare(x.x, y.x);
                if (c == 0)
                    c = x.x.Compare(x.y, y.y);
                return c;
            }

            #endregion
        }

        #endregion

        #region Nested type: Rational

        private class Rational : IComparer<Rational>
        {
            public readonly long p;
            public readonly long q;

            public Rational(long p, long q)
            {
                long g = gcd(p, q);
                this.p = p/g;
                this.q = q/g;
            }

            #region IComparer<Rational> Members

            public int Compare(Rational x, Rational y)
            {
                return (x.p*y.q).CompareTo(x.q*y.p);
            }

            #endregion

            private long gcd(long a, long b)
            {
                if (b == 0)
                    return a;
                return gcd(b, a%b);
            }
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Sign_Posts
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var a = new long[n];
            var b = new long[n];
            var c = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Next();
                b[i] = Next();
                c[i] = Next();
            }

            var remain = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                remain.Add(i);
            }

            var result = new List<Tuple<int, int>>();

            for (int kk = 0; kk < k; kk++)
            {
                if (remain.Count < 2)
                {
                    if (remain.Count == 1)
                    {
                        result.Add(new Tuple<int, int>(remain[0], -2));
                    }
                    remain.Clear();
                    break;
                }

                int max = Math.Min(remain.Count, 100);

                var list = new List<Point>();
                for (int i = 0; i < max; i++)
                {
                    for (int j = i + 1; j < max; j++)
                    {
                        long l1 = a[i]*b[j] - a[j]*b[i];
                        if (l1 == 0)
                            continue;

                        long r1 = c[i]*b[j] - c[j]*b[i];
                        long r2 = c[i]*a[j] - c[j]*a[i];

                        list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));
                    }
                }

                if (list.Count == 0)
                {
                    result.Add(new Tuple<int, int>(remain[remain.Count - 1], -2));
                    remain.RemoveAt(remain.Count - 1);
                }
                else
                {
                    max = 0;

                    list.Sort(list[0]);

                    int count = 1;
                    int mc = 1;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Compare(list[i], list[i - 1]) == 0)
                        {
                            count++;
                        }
                        else
                        {
                            if (count > mc)
                            {
                                mc = count;
                                max = i - 1;
                            }
                            count = 1;
                        }
                    }

                    result.Add(new Tuple<int, int>(list[max]._i1, list[max]._i2));
                    var remain1 = new List<int>(n);

                    foreach (int i in remain)
                    {
                        if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)
                        {
                            remain1.Add(i);
                        }
                    }

                    remain = remain1;
                }
            }

            if (remain.Count != 0)
            {
                writer.WriteLine("NO");
            }
            else
            {
                writer.WriteLine("YES");
                writer.WriteLine(result.Count);

                foreach (var tuple in result)
                {
                    writer.Write(tuple.Item1 + 1);
                    writer.Write(' ');
                    writer.WriteLine(tuple.Item2 + 1);
                }
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            int m = 1;
            do
            {
                c = reader.Read();
                if (c == '-')
                    m = -1;
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }

        #region Nested type: Point

        private class Point : IComparer<Point>
        {
            public readonly int _i1;
            public readonly int _i2;
            public readonly Rational x;
            public readonly Rational y;

            public Point(Rational x, Rational y, int i1, int i2)
            {
                this.x = x;
                this.y = y;
                _i1 = i1;
                _i2 = i2;
            }

            #region IComparer<Point> Members

            public int Compare(Point x, Point y)
            {
                int c = x.x.Compare(x.x, y.x);
                if (c == 0)
                    c = x.x.Compare(x.y, y.y);
                return c;
            }

            #endregion
        }

        #endregion

        #region Nested type: Rational

        private class Rational : IComparer<Rational>
        {
            public readonly long p;
            public readonly long q;

            public Rational(long p, long q)
            {
                long g = gcd(p, q);
                this.p = p/g;
                this.q = q/g;
            }

            #region IComparer<Rational> Members

            public int Compare(Rational x, Rational y)
            {
                return (x.p*y.q).CompareTo(x.q*y.p);
            }

            #endregion

            private long gcd(long a, long b)
            {
                if (b == 0)
                    return a;
                return gcd(b, a%b);
            }
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Sign_Posts
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var a = new long[n];
            var b = new long[n];
            var c = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Next();
                b[i] = Next();
                c[i] = Next();
            }

            var remain = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                remain.Add(i);
            }

            var result = new List<Tuple<int, int>>();

            for (int kk = 0; kk < k; kk++)
            {
                if (remain.Count < 3)
                {
                    if (remain.Count == 1)
                    {
                        result.Add(new Tuple<int, int>(remain[0], -2));
                    }
                    else if (remain.Count == 2)
                    {
                        result.Add(new Tuple<int, int>(remain[0], remain[1]));
                    }
                    remain.Clear();
                    break;
                }

                int max = Math.Min(remain.Count, 100);

                var list = new List<Point>();
                for (int i = 0; i < max; i++)
                {
                    for (int j = i + 1; j < max; j++)
                    {
                        long l1 = a[i]*b[j] - a[j]*b[i];
                        if (l1 == 0)
                            continue;

                        long r1 = c[i]*b[j] - c[j]*b[i];
                        long r2 = c[i]*a[j] - c[j]*a[i];

                        list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));
                    }
                }

                if (list.Count == 0)
                {
                    result.Add(new Tuple<int, int>(remain[remain.Count - 1], -2));
                    remain.RemoveAt(remain.Count - 1);
                }
                else
                {
                    max = 0;

                    int count = 1;
                    int mc = 1;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Compare(list[i], list[i - 1]) == 0)
                        {
                            count++;
                        }
                        else
                        {
                            if (count > mc)
                            {
                                mc = count;
                                max = i - 1;
                            }
                            count = 1;
                        }
                    }

                    result.Add(new Tuple<int, int>(list[max]._i1, list[max]._i2));
                    var remain1 = new List<int>(n);

                    foreach (int i in remain)
                    {
                        if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)
                        {
                            remain1.Add(i);
                        }
                    }

                    remain = remain1;
                }
            }

            if (remain.Count != 0)
            {
                writer.WriteLine("NO");
            }
            else
            {
                writer.WriteLine("YES");
                writer.WriteLine(result.Count);

                foreach (var tuple in result)
                {
                    writer.Write(tuple.Item1 + 1);
                    writer.Write(' ');
                    writer.WriteLine(tuple.Item2 + 1);
                }
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }

        #region Nested type: Point

        private class Point : IComparer<Point>
        {
            public readonly int _i1;
            public readonly int _i2;
            public readonly Rational x;
            public readonly Rational y;

            public Point(Rational x, Rational y, int i1, int i2)
            {
                this.x = x;
                this.y = y;
                _i1 = i1;
                _i2 = i2;
            }

            #region IComparer<Point> Members

            public int Compare(Point x, Point y)
            {
                int c = x.x.Compare(x.x, y.x);
                if (c == 0)
                    c = x.x.Compare(x.y, y.y);
                return c;
            }

            #endregion
        }

        #endregion

        #region Nested type: Rational

        private class Rational : IComparer<Rational>
        {
            public readonly long p;
            public readonly long q;

            public Rational(long p, long q)
            {
                long g = gcd(p, q);
                this.p = p/g;
                this.q = q/g;
            }

            #region IComparer<Rational> Members

            public int Compare(Rational x, Rational y)
            {
                return (x.p*y.q).CompareTo(x.q*y.p);
            }

            #endregion

            private long gcd(long a, long b)
            {
                if (b == 0)
                    return a;
                return gcd(b, a%b);
            }
        }

        #endregion
    }
}