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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
template <class T = int>
inline T readInt();
inline double readDouble();
inline int readUInt();
inline int readChar();
inline void readWord(char *s);
inline bool readLine(char *s);
inline bool isEof();
inline int getChar();
inline int peekChar();
inline bool seekEof();
inline void skipBlanks();
template <class T>
inline void writeInt(T x, char end = 0, int len = -1);
inline void writeChar(int x);
inline void writeWord(const char *s);
inline void writeDouble(double x, int len = 0);
inline void flush();
static struct buffer_flusher_t {
  ~buffer_flusher_t() { flush(); }
} buffer_flusher;
static const int buf_size = 4096;
static unsigned char buf[buf_size];
static int buf_len = 0, buf_pos = 0;
inline bool isEof() {
  if (buf_pos == buf_len) {
    buf_pos = 0, buf_len = fread(buf, 1, buf_size, stdin);
    if (buf_pos == buf_len) return 1;
  }
  return 0;
}
inline int getChar() { return isEof() ? -1 : buf[buf_pos++]; }
inline int peekChar() { return isEof() ? -1 : buf[buf_pos]; }
inline bool seekEof() {
  int c;
  while ((c = peekChar()) != -1 && c <= 32) buf_pos++;
  return c == -1;
}
inline void skipBlanks() {
  while (!isEof() && buf[buf_pos] <= 32U) buf_pos++;
}
inline int readChar() {
  int c = getChar();
  while (c != -1 && c <= 32) c = getChar();
  return c;
}
inline int readUInt() {
  int c = readChar(), x = 0;
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  return x;
}
template <class T>
inline T readInt() {
  int s = 1, c = readChar();
  T x = 0;
  if (c == '-')
    s = -1, c = getChar();
  else if (c == '+')
    c = getChar();
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  return s == 1 ? x : -x;
}
inline double readDouble() {
  int s = 1, c = readChar();
  double x = 0;
  if (c == '-') s = -1, c = getChar();
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  if (c == '.') {
    c = getChar();
    double coef = 1;
    while ('0' <= c && c <= '9') x += (c - '0') * (coef *= 1e-1), c = getChar();
  }
  return s == 1 ? x : -x;
}
inline void readWord(char *s) {
  int c = readChar();
  while (c > 32) *s++ = c, c = getChar();
  *s = 0;
}
inline bool readLine(char *s) {
  int c = getChar();
  while (c != '\n' && c != -1) *s++ = c, c = getChar();
  *s = 0;
  return c != -1;
}
static int write_buf_pos = 0;
static char write_buf[buf_size];
inline void writeChar(int x) {
  if (write_buf_pos == buf_size)
    fwrite(write_buf, 1, buf_size, stdout), write_buf_pos = 0;
  write_buf[write_buf_pos++] = x;
}
inline void flush() {
  if (write_buf_pos)
    fwrite(write_buf, 1, write_buf_pos, stdout), write_buf_pos = 0;
}
template <class T>
inline void writeInt(T x, char end, int output_len) {
  if (x < 0) writeChar('-'), x = -x;
  char s[24];
  int n = 0;
  while (x || !n) s[n++] = '0' + x % 10, x /= 10;
  while (n < output_len) s[n++] = '0';
  while (n--) writeChar(s[n]);
  if (end) writeChar(end);
}
inline void writeWord(const char *s) {
  while (*s) writeChar(*s++);
}
inline void writeDouble(double x, int output_len) {
  if (x < 0) writeChar('-'), x = -x;
  int t = (int)x;
  writeInt(t), x -= t;
  writeChar('.');
  for (int i = output_len - 1; i > 0; i--) {
    x *= 10;
    t = std::min(9, (int)x);
    writeChar('0' + t), x -= t;
  }
  x *= 10;
  t = std::min(9, (int)(x + 0.5));
  writeChar('0' + t);
}
struct Point {
  int x;
  int y;
  int z;
};
struct Query {
  pair<int, int> x;
  pair<int, int> y;
  pair<int, int> z;
  int ind;
};
struct Step {
  pair<int, int> x;
  pair<int, int> y;
  int z;
  int ind;
  int coeff;
};
bool cmp(Point &a, Point &b) { return (a.z < b.z); }
bool Cmp(Step &a, Step &b) { return (a.z < b.z); }
int X;
int rmq[400010];
struct Vertex {
  int l;
  int r;
  int pr;
  int sz;
  int value;
};
vector<Vertex> decart;
pair<int, int> SP = make_pair(-1, -1);
void update(int vertex) {
  if (vertex == -1) return;
  int sz = 1;
  if (decart[vertex].l != -1) {
    sz += decart[decart[vertex].l].sz;
  }
  if (decart[vertex].r != -1) {
    sz += decart[decart[vertex].r].sz;
  }
  decart[vertex].sz = sz;
}
pair<int, int> split(int father, int number) {
  if (father == -1) return SP;
  int l = 1;
  if (decart[father].l != -1) {
    l += decart[decart[father].l].sz;
  }
  if (decart[father].value < number) {
    pair<int, int> p = split(decart[father].r, number);
    decart[father].r = p.first;
    p.first = father;
    update(father);
    return p;
  }
  pair<int, int> p = split(decart[father].l, number);
  decart[father].l = p.second;
  p.second = father;
  update(father);
  return p;
}
int merg(int first, int second) {
  if (first == -1) return second;
  if (second == -1) return first;
  if (decart[first].pr >= decart[second].pr) {
    int v = merg(decart[first].r, second);
    decart[first].r = v;
    update(first);
    return first;
  }
  int v = merg(first, decart[second].l);
  decart[second].l = v;
  update(second);
  return second;
}
int get_left(int base, int value) {
  if (base == -1) return 0;
  if (decart[base].value >= value) return get_left(decart[base].l, value);
  int sz = 1;
  if (decart[base].l != -1) sz += decart[decart[base].l].sz;
  return sz + get_left(decart[base].r, value);
}
int add(int base, int value) {
  pair<int, int> p = split(base, value);
  decart.push_back({-1, -1, rand(), 1, value});
  base = merg(p.first, decart.size() - 1);
  base = merg(base, p.second);
  return base;
}
void change(int i, int l, int r, int ind, int val) {
  rmq[i] = add(rmq[i], val);
  if (r - l == 1) return;
  int mid = (l + r) / 2;
  if (ind < mid)
    change(2 * i + 1, l, mid, ind, val);
  else
    change(2 * i + 2, mid, r, ind, val);
}
void Change(int x, int y) { change(0, 0, X + 1, x, y); }
int get(int i, int l, int r, int l1, int r1, pair<int, int> &y) {
  if (l1 >= r1) return 0;
  if (l == l1 && r == r1) {
    return get_left(rmq[i], y.second + 1) - get_left(rmq[i], y.first);
  }
  int mid = (l + r) / 2;
  return get(2 * i + 1, l, mid, l1, min(r1, mid), y) +
         get(2 * i + 2, mid, r, max(l1, mid), r1, y);
}
int Get(pair<int, int> &x, pair<int, int> &y) {
  return get(0, 0, X + 1, x.first, x.second + 1, y);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int Y, Z;
  X = readInt();
  Y = readInt();
  Z = readInt();
  int INF = 1e7;
  pair<int, int> G = make_pair(INF, -INF);
  pair<int, int> xm = G, ym = G, zm = G;
  int n, m, k;
  n = readInt();
  m = readInt();
  k = readInt();
  for (int i = 0; i < n; i++) {
    int x, y, z;
    x = readInt();
    y = readInt();
    z = readInt();
    xm.first = min(xm.first, x);
    xm.second = max(xm.second, x);
    ym.first = min(ym.first, y);
    ym.second = max(ym.second, y);
    zm.first = min(zm.first, z);
    zm.second = max(zm.second, z);
  }
  vector<Point> p;
  for (int i = 0; i < m; i++) {
    int x, y, z;
    x = readInt();
    y = readInt();
    z = readInt();
    bool abl = true;
    if (!(x >= xm.first && x <= xm.second)) {
      abl = false;
    }
    if (!(y >= ym.first && y <= ym.second)) {
      abl = false;
    }
    if (!(z >= zm.first && z <= zm.second)) {
      abl = false;
    }
    if (abl) {
      cout << "INCORRECT";
      return 0;
    }
    p.push_back({x, y, z});
  }
  cout << "CORRECT"
       << "\n";
  vector<Query> d;
  vector<bool> know(k);
  vector<int> pts(k);
  fill(pts.begin(), pts.end(), 0);
  for (int i = 0; i < k; i++) {
    int x, y, z;
    x = readInt();
    y = readInt();
    z = readInt();
    pair<int, int> xx = xm, yy = ym, zz = zm;
    xx.first = min(xx.first, x);
    xx.second = max(xx.second, x);
    yy.first = min(yy.first, y);
    yy.second = max(yy.second, y);
    zz.first = min(zz.first, z);
    zz.second = max(zz.second, z);
    if (xx == xm && yy == ym && zz == zm)
      know[i] = true;
    else {
      know[i] = false;
      d.push_back({xx, yy, zz, i});
    }
  }
  sort(p.begin(), p.end(), cmp);
  vector<Step> r;
  for (int i = 0; i < d.size(); i++) {
    r.push_back({d[i].x, d[i].y, d[i].z.first - 1, d[i].ind, -1});
    r.push_back({d[i].x, d[i].y, d[i].z.second, d[i].ind, 1});
  }
  sort(r.begin(), r.end(), Cmp);
  for (int i = 0; i < 4 * (X + 1); i++) rmq[i] = -1;
  int u = 0;
  for (int i = 0; i < p.size(); i++) {
    while (u < r.size() && r[u].z < p[i].z) {
      int res = Get(r[u].x, r[u].y);
      int ind = r[u].ind, cf = r[u].coeff;
      pts[ind] += res * cf;
      u++;
    }
    Change(p[i].x, p[i].y);
  }
  while (u < r.size()) {
    int res = Get(r[u].x, r[u].y);
    int ind = r[u].ind, cf = r[u].coeff;
    pts[ind] += res * cf;
    u++;
  }
  for (int i = 0; i < k; i++) {
    if (know[i]) {
      cout << "OPEN"
           << "\n";
    } else {
      if (pts[i] == 0)
        cout << "UNKNOWN"
             << "\n";
      else
        cout << "CLOSED"
             << "\n";
    }
  }
  return 0;
}