import java.io.*;
import java.util.*;

public class highways_as_nm implements Runnable {
    BufferedReader in;
    StringTokenizer st;

    int nextInt() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
            }
        }
        return Integer.parseInt(st.nextToken());
    }

    class Line {
        long a;
        long b;
        long c;

        Line(long a, long b, long c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        long dist(Point p) {
            return (a * p.x + b * p.y + c);
        }
    }

    class Point {
        long x;
        long y;

        public Point(long x, long y) {
            this.x = x;
            this.y = y;
        }

        Point subtract(Point p) {
            return new Point(x - p.x, y - p.y);
        }

        public long sqLen() {
            return x * x + y * y;
        }

        @Override
        public String toString() {
            return "(" + x + "," + y + ")";
        }
    }

    long vp(Point v1, Point v2) {
        return v1.x * v2.y - v1.y * v2.x;
    }

    public void solve() throws IOException {
        in = new BufferedReader(new FileReader("highways.in"));
        PrintWriter out = new PrintWriter(new File("highways.out"));

        int ln = nextInt();
        int n = nextInt();

        Line[] lines = new Line[ln];
        for (int i = 0; i < ln; i++) {
            lines[i] = new Line(nextInt(), nextInt(), nextInt());
        }
        Point[] p = new Point[n];

        for (int i = 0; i < n; i++) {
            p[i] = new Point(nextInt(), nextInt());
        }


        ArrayList<Integer> answer = new ArrayList<Integer>();
        for (int i = 0; i < ln; i++) {
            long[] d = new long[2];
            for (int j = 0; j < 2; j++) {
                d[j] = Long.MIN_VALUE;

                for (int k = 0; k < n; k++) {
                    d[j] = Math.max(d[j], lines[i].dist(p[k]));
                }

                d[j] = (2 * j - 1) * d[j];
                lines[i].a = -lines[i].a;
                lines[i].b = -lines[i].b;
                lines[i].c = -lines[i].c;
            }

            if (!(d[0] > 0 && d[1] > 0 || d[0] < 0 && d[1] < 0)) {
                answer.add(i);
            }
        }

        out.println(answer.size());
        for (int x : answer) {
            out.print((x + 1) + " ");
        }
        out.println();

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new highways_as_nm()).start();
    }
}