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

public class japanese_md implements Runnable {
	class Point implements Comparable<Point> {
		int x, y;
		
		public Point(Scanner in) {
			x = in.nextInt();
			y = in.nextInt();
		}
		
		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}

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

		public int getDirection(Point p) {
			return 3 * Integer.signum(x - p.x) + Integer.signum(y - p.y);
		}
	}
	
	class Figure {
		int n;
		Point[] p;
		Point[] ind;
		TreeMap<Point, Integer> tm;
		ArrayList<Point> ps;
		
		public Figure(Scanner in) {
			n = in.nextInt();
			p = new Point[2 * n];
			for (int i = 0; i < 2 * n; i++) {
				p[i] = new Point(in);
			}
			setIndex();
		}
		
		public void setIndex() {
			TreeSet<Point> ts = new TreeSet<Point>();
			for (Point pp : p)
				ts.add(pp);
			ps = new ArrayList<Point>(ts);
			tm = new TreeMap<Point, Integer>();
			for (Point pp : ps)
				tm.put(pp, tm.size());
			ind = new Point[n];
			for (int i = 0; i < n; i++) {
				ind[i] = new Point(tm.get(p[2 * i]), tm.get(p[2 * i + 1]));
			}
			Arrays.sort(ind);
		}

		public boolean corresponds(Figure f) {
			if (n != f.n)
				return false;
			for (int i = 0; i < n; i++)
				if (ind[i].compareTo(f.ind[i]) != 0)
					return false;
			for (int i = 0; i < ps.size(); i++) {
				for (int j = i + 1; j < ps.size(); j++) {
					int dir1 = ps.get(i).getDirection(ps.get(j));
					int dir2 = f.ps.get(i).getDirection(f.ps.get(j));
					if (dir1 != dir2)
						return false;
				}
			}
			return true;
		}
	}

	private Scanner in;
	private PrintWriter out;

	public void run() {
		try {
			solve();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	
	private void solve() throws IOException {
		in = new Scanner(new FileReader("japanese.in"));
		out = new PrintWriter("japanese.out");
		int figs = in.nextInt();
		Figure[] f = new Figure[figs];
		for (int i = 0; i < figs; i++) {
			f[i] = new Figure(in);
			if (i > 0) {
				boolean eq = f[0].corresponds(f[i]);
				out.println(eq ? "CORRECT" : "INCORRECT");
			}
		}
		in.close();
		out.close();
	}
	
	public static void main(String[] args) {
		new Thread(new japanese_md()).start();
	}

}
