/*--------------------------------------------------------------*/
/* ACM ICPC 2007-2008                                           */
/* Northeastern European Regional Contest                       */
/* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*/
/*--------------------------------------------------------------*/
/* Problem J. Japanese Writing                                  */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Petr Mitrichev                         */
/*--------------------------------------------------------------*/
 
import java.util.*;
import java.io.*;

public class japanese_petr implements Runnable {
    final String TASK_ID = "japanese";
    final String IN_FILE = TASK_ID + ".in";
    final String OUT_FILE = TASK_ID + ".out";

    public static void main(String[] args) {
        Locale.setDefault(Locale.US);
        new Thread(new japanese_petr()).start();
    }

    public void run() {
        try {
            readInput();
            solve();
            writeOutput();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(57);
        }
    }

    static class Point implements Comparable<Point> {
        int x;
        int y;
        Point pair = null;

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

        public int compareTo(Point o) {
            int z = x - o.x;
            if (z == 0)
                z = y - o.y;
            return z;
        }


        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Point point = (Point) o;

            if (x != point.x) return false;
            if (y != point.y) return false;

            return true;
        }

        public int hashCode() {
            int result;
            result = x;
            result = 31 * result + y;
            return result;
        }

        public int dir(Point o) {
            int z = (int) Math.signum(x - o.x);
            int zz = (int) Math.signum(y - o.y);
            return (z + 1) * 3 + (zz + 1);
        }
    }

    static class Segment {
        Point s;
        Point e;

        public Segment(Point s, Point e) {
            this.s = s;
            this.e = e;
        }
    }


    private void solve() throws IOException {
        PrintWriter writer = new PrintWriter(OUT_FILE);

        m = nextInt();
        good = new TreeMap<Point, Point>();
        goodsegs = new ArrayList<Segment>();
        for (int i = 0; i < m; ++i) {
            int x1 = nextInt();
            int y1 = nextInt();
            int x2 = nextInt();
            int y2 = nextInt();
            Point s = new Point(x1, y1);
            Point e = new Point(x2, y2);
            if (good.containsKey(s))
                s = good.get(s);
            else
                good.put(s, s);
            if (good.containsKey(e))
                e = good.get(e);
            else
                good.put(e, e);
            goodsegs.add(new Segment(s, e));
        }
        for (int jjj = 1; jjj < n; ++jjj) {
            int cm = nextInt();
            boolean ok = (cm == m);
            TreeMap<Point, Point> cur = new TreeMap<Point, Point>();
            List<Segment> cursegs = new ArrayList<Segment>();
            for (int i = 0; i < cm; ++i) {
                int x1 = nextInt();
                int y1 = nextInt();
                int x2 = nextInt();
                int y2 = nextInt();
                Point s = new Point(x1, y1);
                Point e = new Point(x2, y2);
                if (cur.containsKey(s))
                    s = cur.get(s);
                else
                    cur.put(s, s);
                if (cur.containsKey(e))
                    e = cur.get(e);
                else
                    cur.put(e, e);
                cursegs.add(new Segment(s, e));
            }
            ok &= cur.size() == good.size();
            if (ok) {
                List<Point> l1 = new ArrayList<Point>(cur.values());
                List<Point> l2 = new ArrayList<Point>(good.values());
                for (int i = 0; i < l1.size(); ++i)
                    l1.get(i).pair = l2.get(i);
                for (Point u : cur.values())
                    for (Point uu : cur.values()) {
                        if (u.dir(uu) != u.pair.dir(uu.pair))
                            ok = false;
                    }
                for (Segment s : cursegs) {
                    boolean got = false;
                    for (Segment ss : goodsegs)
                        if (s.s.pair == ss.s && s.e.pair == ss.e)
                            got = true;
                    if (!got)
                        ok = false;
                }
            }
            if (ok) {
                writer.println("CORRECT");
            } else {
                writer.println("INCORRECT");
            }
        }
        writer.close();
    }

    int n;
    int m;
    TreeMap<Point, Point> good;
    List<Segment> goodsegs;


    private void writeOutput() throws FileNotFoundException {
    }

    private void readInput() throws IOException {
        reader = new BufferedReader(new FileReader(IN_FILE));
        tokenizer = null;

        n = nextInt();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}
