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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template <typename T, typename... U>
inline void read(T& x, U&... y) {
  read(x), read(y...);
}
const int N = 1e5 + 10;
int MAXX, MAXY, MAXZ, n, m, K, opt, root;
int X1, X2, X3, X4, Y1, Y2, Y3, Y4, Z1, Z2, Z3, Z4;
bool ANS;
struct Data {
  int P[3];
  bool operator<(const Data& b) const { return P[opt] < b.P[opt]; }
} st[N];
struct Node {
  int P[3], MINV[3], MAXV[3];
} tr[N];
struct K_DTree {
  int MAXV[N], ID[N], son[N][2];
  void Updata(int a, int b) {
    tr[a].MAXV[0] = max(tr[a].MAXV[0], tr[b].MAXV[0]);
    tr[a].MAXV[1] = max(tr[a].MAXV[1], tr[b].MAXV[1]);
    tr[a].MAXV[2] = max(tr[a].MAXV[2], tr[b].MAXV[2]);
    tr[a].MINV[0] = min(tr[a].MINV[0], tr[b].MINV[0]);
    tr[a].MINV[1] = min(tr[a].MINV[1], tr[b].MINV[1]);
    tr[a].MINV[2] = min(tr[a].MINV[2], tr[b].MINV[2]);
  }
  void Pushup(int rt) {
    if (son[rt][0]) Updata(rt, son[rt][0]);
    if (son[rt][1]) Updata(rt, son[rt][1]);
  }
  void Build(int& rt, int l, int r, int dep) {
    if (l > r) {
      rt = 0;
      return;
    }
    int mid = l + r >> 1;
    opt = dep % 3;
    rt = ID[mid];
    nth_element(st + l, st + mid, st + r + 1);
    tr[rt].P[0] = tr[rt].MAXV[0] = tr[rt].MINV[0] = st[mid].P[0];
    tr[rt].P[1] = tr[rt].MAXV[1] = tr[rt].MINV[1] = st[mid].P[1];
    tr[rt].P[2] = tr[rt].MAXV[2] = tr[rt].MINV[2] = st[mid].P[2];
    Build(son[rt][0], l, mid - 1, dep + 1);
    Build(son[rt][1], mid + 1, r, dep + 1);
    Pushup(rt);
  }
  bool Cover(int x1, int y1, int z1, int x2, int y2, int z2, int a, int b,
             int c, int d, int e, int f) {
    return x1 <= a && y1 <= b && z1 <= c && d <= x2 && e <= y2 && f <= z2;
  }
  bool Cross(Node t, int x1, int y1, int z1, int x2, int y2, int z2) {
    int a = t.MINV[0], b = t.MINV[1], c = t.MINV[2], d = t.MAXV[0],
        e = t.MAXV[1], f = t.MAXV[2];
    return max(a - x2, 0) + max(x1 - d, 0) + max(b - y2, 0) + max(y1 - e, 0) +
               max(c - z2, 0) + max(z1 - f, 0) ==
           0;
  }
  void Query(int rt, int x1, int y1, int z1, int x2, int y2, int z2) {
    if (ANS) return;
    if (Cover(x1, y1, z1, x2, y2, z2, tr[rt].MINV[0], tr[rt].MINV[1],
              tr[rt].MINV[2], tr[rt].MAXV[0], tr[rt].MAXV[1], tr[rt].MAXV[2])) {
      ANS = true;
      return;
    }
    if (Cover(x1, y1, z1, x2, y2, z2, tr[rt].P[0], tr[rt].P[1], tr[rt].P[2],
              tr[rt].P[0], tr[rt].P[1], tr[rt].P[2])) {
      ANS = true;
      return;
    }
    if (son[rt][0] && Cross(tr[son[rt][0]], x1, y1, z1, x2, y2, z2))
      Query(son[rt][0], x1, y1, z1, x2, y2, z2);
    if (son[rt][1] && Cross(tr[son[rt][1]], x1, y1, z1, x2, y2, z2))
      Query(son[rt][1], x1, y1, z1, x2, y2, z2);
  }
} KD;
int main() {
  read(MAXX, MAXY, MAXZ, n, m, K);
  X1 = MAXX;
  Y1 = MAXY;
  Z1 = MAXZ;
  for (int i = 1; i <= n; ++i) {
    int x, y, z;
    read(x, y, z);
    X1 = min(X1, x);
    X2 = max(X2, x);
    Y1 = min(Y1, y);
    Y2 = max(Y2, y);
    Z1 = min(Z1, z);
    Z2 = max(Z2, z);
  }
  for (int i = 1; i <= m; ++i)
    read(st[i].P[0], st[i].P[1], st[i].P[2]), KD.ID[i] = i;
  KD.Build(root, 1, m, 1);
  ANS = false;
  KD.Query(root, X1, Y1, Z1, X2, Y2, Z2);
  if (ANS) return puts("INCORRECT"), 0;
  puts("CORRECT");
  for (int i = 1; i <= K; ++i) {
    int x, y, z;
    read(x, y, z);
    X3 = X1;
    X4 = X2;
    Y3 = Y1;
    Y4 = Y2;
    Z3 = Z1;
    Z4 = Z2;
    X3 = min(X3, x);
    X4 = max(X4, x);
    Y3 = min(Y3, y);
    Y4 = max(Y4, y);
    Z3 = min(Z3, z);
    Z4 = max(Z4, z);
    if (X1 == X3 && X2 == X4 && Y1 == Y3 && Y2 == Y4 && Z1 == Z3 && Z2 == Z4)
      puts("OPEN");
    else {
      ANS = false;
      KD.Query(root, X3, Y3, Z3, X4, Y4, Z4);
      if (ANS)
        puts("CLOSED");
      else
        puts("UNKNOWN");
    }
  }
  return 0;
}