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

public class japanese_rs implements Runnable {
	private BufferedReader in;
	private PrintWriter out;
	
	private class Hieroglyph {
		private int m;
		private int[] x1;
		private int[] y1;
		private int[] x2;
		private int[] y2;
		
		public Hieroglyph(int m) {
			x1 = new int[m];
			y1 = new int[m];
			x2 = new int[m];
			y2 = new int[m];
			this.m = 0;
		}
		
		public void addStroke(int x1, int y1, int x2, int y2) {
			this.x1[m] = x1;
			this.y1[m] = y1;
			this.x2[m] = x2;
			this.y2[m] = y2;
			m++;
		}
		
		public void compress() {
			TreeSet<Integer> x = new TreeSet<Integer>();
			TreeSet<Integer> y = new TreeSet<Integer>();
			for (int i = 0; i < m; i++) {
				x.add(x1[i]);
				y.add(y1[i]);
				x.add(x2[i]);
				y.add(y2[i]);
			}
			int[] xx = new int[x.size()];
			int[] yy = new int[y.size()];
			int count = 0;
			for (int z: x) {
				xx[count++] = z;
			}
			count = 0;
			for (int z: y) {
				yy[count++] = z;
			}
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < xx.length; j++) {
					if (x1[i] == xx[j]) {
						x1[i] = j;
						break;
					}
				}
				for (int j = 0; j < xx.length; j++) {
					if (x2[i] == xx[j]) {
						x2[i] = j;
						break;
					}
				}
				for (int j = 0; j < yy.length; j++) {
					if (y1[i] == yy[j]) {
						y1[i] = j;
						break;
					}
				}
				for (int j = 0; j < yy.length; j++) {
					if (y2[i] == yy[j]) {
						y2[i] = j;
						break;
					}
				}
			}
		}
		
		public boolean isSame(Hieroglyph that) {
			if (this.m != that.m) {
				return false;
			}
			for (int i = 0; i < m; i++) {
				boolean found = false;
				for (int j = 0; j < m; j++) {
					if ((this.x1[i] == that.x1[j]) && (this.y1[i] == that.y1[j]) && (this.x2[i] == that.x2[j]) && (this.y2[i] == that.y2[j])) {
						found = true;
						break;
					}
				}
				if (!found) {
					return false;
				}
			}
			return true;
		}
	}
	
	private void solve() throws IOException {
		int n = Integer.parseInt(in.readLine());
		Hieroglyph[] hieroglyphs = new Hieroglyph[n];
		for (int i = 0; i < n; i++) {
			int m = Integer.parseInt(in.readLine());
			hieroglyphs[i] = new Hieroglyph(m);
			for (int j = 0; j < m; j++) {
				StringTokenizer st = new StringTokenizer(in.readLine());
				int x1 = Integer.parseInt(st.nextToken());
				int y1 = Integer.parseInt(st.nextToken());
				int x2 = Integer.parseInt(st.nextToken());
				int y2 = Integer.parseInt(st.nextToken());
				hieroglyphs[i].addStroke(x1, y1, x2, y2);
			}
			hieroglyphs[i].compress();
		}
		for (int i = 1; i < n; i++) {
			out.println(hieroglyphs[0].isSame(hieroglyphs[i]) ? "CORRECT" : "INCORRECT");
		}
	}
	
	public static void main(String[] args) {
		new Thread(new japanese_rs()).start();
	}

	public void run() {
		String problem = getClass().getName().split("_")[0];
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
