Problem: Natasha was already going to fly back to Earth when she remembered that she needs to go to the Martian store to buy Martian souvenirs for her friends.

It is known, that the Martian year lasts x_{max} months, month lasts y_{max} days, day lasts z_{max} seconds. Natasha also knows that this store works according to the following schedule: 2 months in a year were selected: x_l and x_r (1≤ x_l≤ x_r≤ x_{max}), 2 days in a month: y_l and y_r (1≤ y_l≤ y_r≤ y_{max}) and 2 seconds in a day: z_l and z_r (1≤ z_l≤ z_r≤ z_{max}). The store works at all such moments (month x, day y, second z), when simultaneously x_l≤ x≤ x_r, y_l≤ y≤ y_r and z_l≤ z≤ z_r.

Unfortunately, Natasha does not know the numbers x_l,x_r,y_l,y_r,z_l,z_r.

One Martian told Natasha: "I went to this store (n+m) times. n times of them it was opened, and m times — closed." He also described his every trip to the store: the month, day, second of the trip and whether the store was open or closed at that moment.

Natasha can go to the store k times. For each of them, determine whether the store at the time of the trip is open, closed, or this information is unknown.

Input

The first line contains 6 integers x_{max}, y_{max}, z_{max}, n, m, k (1≤ x_{max},y_{max},z_{max}≤ 10^5, 1≤ n≤ 10^5, 0≤ m≤ 10^5, 1≤ k≤ 10^5) — number of months in a year, days in a month, seconds in a day, times when the store (according to a Martian) was opened, when it was closed and Natasha's queries.

The i-th of the next n lines contains 3 integers x_i, y_i, z_i (1≤ x_i≤ x_{max}, 1≤ y_i≤ y_{max}, 1≤ z_i≤ z_{max}) — month, day and second of i-th time, when the store, according to the Martian, was opened.

The i-th of the next m lines contains 3 integers x_i, y_i, z_i (1≤ x_i≤ x_{max}, 1≤ y_i≤ y_{max}, 1≤ z_i≤ z_{max}) — month, day and second of i-th time, when the store, according to the Martian, was closed.

The i-th of the next k lines contains 3 integers x_i, y_i, z_i (1≤ x_i≤ x_{max}, 1≤ y_i≤ y_{max}, 1≤ z_i≤ z_{max}) — month, day and second of i-th Natasha's query.

Output

If the Martian was mistaken and his information about when the store is open and when it is closed is inconsistent, print a single line "INCORRECT" (without quotes).

Otherwise, print the first line "CORRECT" (without quotes). Next output k lines: in i-th of them, output an answer to i-th Natasha's query: "OPEN" (without quotes), if the store was opened at the moment of this query, "CLOSED" (without quotes), if it was closed, or "UNKNOWN" (without quotes), if this information can not be determined on the basis of available data.

Examples

Input

10 10 10 3 1 3
2 6 2
4 2 4
6 4 6
9 9 9
3 3 3
10 10 10
8 8 8


Output

CORRECT
OPEN
CLOSED
UNKNOWN


Input

10 10 10 1 1 1
2 5 7
2 5 7
8 9 10


Output

INCORRECT

Note

Consider the first test case.

There are 10 months in a year, 10 days in a month, and 10 seconds in a day.

The store was opened in 3 moments:

  * month 2, day 6, second 2;
  * month 4, day 2, second 4;
  * month 6, day 4, second 6.



The store was closed at the time: month 9, day 9, second 9.

Queries:

  * month 3, day 3, second 3 — open ("OPEN") (since the store opens no later than month 2, day 2, second 2 and closes no earlier than in month 6, day 6, second 6); 
  * month 10, day 10, second 10 — closed ("CLOSED") (since it is closed even in the month 9, day 9, second 9);
  * month 8, day 8, second 8 — unknown ("UNKNOWN") (because the schedule in which the store is open at this moment exists, and the schedule in which the store is closed at this moment exists as well).



In the second test case, the store was closed and opened at the same time — contradiction ("INCORRECT").

Solution (in JAVA):

Solution:
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.Stack;
import java.util.TreeMap;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
//useless criterias:
//1: forcing jumppads
//2: forcing bounds
//useful methods:
//1: opening to all segments:
//2: predictions
//3: repairing jumppads
public class Test113   { 
        static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
    private static class tuple  {
         int x;
         int y;
         int z;
         int id;
         public tuple(int x, int y, int z, int id)   {
            this.x = x;
            this.y = y;
            this.z = z;
            this.id = id;
         }    
    }       
    private static class Node   {
        int x;
        int y;
        int z;
        int code = 0;
        int id;
        Node left = null;
        Node right = null;
        public Node(int x, int y, int z, int id)   {
            this.x = x;
            this.y = y;
            this.z = z;
           this.id = id;
        }   
        public Node(int x, int y, int z, int code, int id)   {
            this.x = x;
            this.y = y;
            this.z = z;
            this.code = code;
            this.id = id;
        }    
        public boolean compare(int x, int y, int z, int id)   {
            if (code == 0)  {
                if (x != this.x) return x <= this.x;
                return id <= this.id;
            }    
            if (code == 1)  {
                if (y != this.y) return y <= this.y;
                return id <= this.id;
            }    
            else  {
                if (z != this.z) return z <= this.z;
                return id <= this.id;
            }    
        }   
    }    
    static Node root = null;
    static int x0;
    static int y0;
    static int z0;
    static int id0; //tiebreaker
    static int c = 0;
    public static Node add(Node n)  {
        if (n == null)  {
            return new Node(x0, y0, z0, c, id0);
        }    
        else   {
            c = (c + 1) % 3;
            if (n.compare(x0, y0, z0, id0))
                n.left = add(n.left);
            else
                n.right = add(n.right);
            return n;
        }    
    }    
    static int xl;
    static int xr;
    static int yl;
    static int yr;
    static int zl;
    static int zr;
    public static boolean search(Node n)   {
        if (n == null) return false;
        if (n.x >= xl && n.x <= xr && n.y >= yl && n.y <= yr && n.z >= zl && n.z <= zr) return true;
        if (n.code == 0)   {
            if (n.x > xr)
                return search(n.left);
            if (n.x < xl)
                return search(n.right);
            return search(n.left) || search(n.right);
        }   
        else if (n.code == 1)   {
            if (n.y > yr)
                return search(n.left);
            if (n.y < yl)
                return search(n.right);
            return search(n.left) || search(n.right);
        }   
        else {
            if (n.z > zr)
                return search(n.left);
            if (n.z < zl)
                return search(n.right);
            return search(n.left) || search(n.right);
        }   
    }
    public static void main(String[] args)   {
        int nn = 100;
        InputStream inputStream = System.in;
        InputReader sc = new InputReader(inputStream);
        int xmax = sc.nextInt();
        int ymax = sc.nextInt();
        int zmax = sc.nextInt();
        xl = xmax;
        xr = -1;
        yl = ymax;
        yr = -1;
        zl = zmax;
        zr = -1;
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < n; i++)   {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int z = sc.nextInt();
            if (xl > x) xl = x;
            if (xr < x) xr = x;
            if (yl > y) yl = y;
            if (yr < y) yr = y;
            if (zl > z) zl = z;
            if (zr < z) zr = z;
        }   
        tuple[] t = new tuple[m];
        //shuffle
        for (int i = 0; i < m; i++)   {
             t[i] = new tuple(sc.nextInt(), sc.nextInt(), sc.nextInt(), i);
        } 
        for (int i = m - 1; i >= 0; i--)   {
            int l = (int)(Math.random() * i);
            tuple s = t[i];
            t[i] = new tuple(t[l].x, t[l].y, t[l].z, t[l].id);
            t[l] = s;
        }    
        for (int i = 0; i < m; i++)   {
            x0 = t[i].x;
            y0 = t[i].y;
            z0 = t[i].z;
            id0 = t[i].id;
            root = add(root);
        } 
        boolean incorrect = search(root);
        if (incorrect)   {
            ans.append("INCORRECT");
        }   
        else   {
            ans.append("CORRECT");
            ans.append("\n");
            for (int i = 0; i < k; i++)   {
                int xl1 = xl;
                int xr1 = xr;
                int yl1 = yl;
                int yr1 = yr;
                int zl1 = zl;
                int zr1 = zr;
                int x = sc.nextInt();
                int y = sc.nextInt();
               int z = sc.nextInt();
               if (x >= xl && x <= xr && y >= yl && y <= yr && z >= zl && z <= zr)  {
                   ans.append("OPEN");
                   ans.append("\n");
               }   
               else  {
               if (xl > x) xl = x;
               if (xr < x) xr = x;
               if (yl > y) yl = y;
               if (yr < y) yr = y;
               if (zl > z) zl = z;
               if (zr < z) zr = z;
               if (search(root))  {
                   ans.append("CLOSED");
                   ans.append("\n");
               }    
               else  {
                   ans.append("UNKNOWN");
                   ans.append("\n");
               }                
               xl = xl1;
               xr = xr1;
               yl = yl1;
               yr = yr1;
               zl = zl1;
               zr = zr1;
            }   
        }
        }
        System.out.println(ans);    
    }   
}