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("-O3")
using namespace std;
using VS = vector<string>;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VL = vector<LL>;
using VVL = vector<VL>;
template <typename M>
struct BIT0 {
  using T = typename M::t1;
  int N;
  int nn;
  vector<T> data;
  BIT0(int n) {
    N = n + 1;
    data = vector<T>(n + 1, M::id1());
  }
  void update(int i, const T& w) {
    i++;
    for (int x = i; x < N; x += x & -x) {
      data[x] = M::op1(data[x], w);
    }
  }
  T query(int i) {
    T ret = 0;
    for (int x = i; x > 0; x -= x & -x) {
      ret = M::op1(ret, data[x]);
    }
    return ret;
  }
  T query(int l, int r) { return M::op1(query(r), M::inv1(query(l))); }
};
template <typename structure_t, typename M>
struct SegmentTree2DCompressed {
  using T = typename M::t1;
  int sz;
  vector<structure_t> rmqs;
  vector<vector<int> > LL, RR;
  vector<vector<int> > seg;
  SegmentTree2DCompressed(int n) {
    sz = 1;
    while (sz < n) sz <<= 1;
    seg.resize(2 * sz);
    LL.resize(2 * sz);
    RR.resize(2 * sz);
  }
  void update(int a, int x, const T& z, int k, int l, int r) {
    if (r <= a || a + 1 <= l) return;
    if (a <= l && r <= a + 1) return rmqs[k].update(x, z);
    update(a, LL[k][x], z, 2 * k + 0, l, (l + r) >> 1);
    update(a, RR[k][x], z, 2 * k + 1, (l + r) >> 1, r);
    return rmqs[k].update(x, z);
  }
  void update(int x, int y, const T& z) {
    y = lower_bound(begin(seg[1]), end(seg[1]), y) - begin(seg[1]);
    return update(x, y, z, 1, 0, sz);
  }
  T query(int a, int b, int x, int y, int k, int l, int r) {
    if (a >= r || b <= l) return M::id1();
    if (a <= l && r <= b) return rmqs[k].query(x, y);
    return M::op1(query(a, b, LL[k][x], LL[k][y], 2 * k + 0, l, (l + r) >> 1),
                  query(a, b, RR[k][x], RR[k][y], 2 * k + 1, (l + r) >> 1, r));
  }
  T query(int a, int b, int x, int y) {
    x = lower_bound(begin(seg[1]), end(seg[1]), x) - begin(seg[1]);
    y = lower_bound(begin(seg[1]), end(seg[1]), y) - begin(seg[1]);
    return query(a, b, x, y, 1, 0, sz);
  }
  void build() {
    for (int k = (int)seg.size() - 1; k >= sz; k--) {
      sort(begin(seg[k]), end(seg[k]));
      seg[k].erase(unique(begin(seg[k]), end(seg[k])), end(seg[k]));
    }
    for (int k = sz - 1; k > 0; k--) {
      seg[k].resize(seg[2 * k + 0].size() + seg[2 * k + 1].size());
      merge(begin(seg[2 * k + 0]), end(seg[2 * k + 0]), begin(seg[2 * k + 1]),
            end(seg[2 * k + 1]), begin(seg[k]));
      seg[k].erase(unique(begin(seg[k]), end(seg[k])), end(seg[k]));
      LL[k].resize(seg[k].size() + 1);
      RR[k].resize(seg[k].size() + 1);
      int tail1 = 0, tail2 = 0;
      for (int i = 0; i < (int)seg[k].size(); i++) {
        while (tail1 < (int)seg[2 * k + 0].size() &&
               seg[2 * k + 0][tail1] < (int)seg[k][i])
          ++tail1;
        while (tail2 < (int)seg[2 * k + 1].size() &&
               seg[2 * k + 1][tail2] < (int)seg[k][i])
          ++tail2;
        LL[k][i] = tail1, RR[k][i] = tail2;
      }
      LL[k][seg[k].size()] = (int)seg[2 * k + 0].size();
      RR[k][seg[k].size()] = (int)seg[2 * k + 1].size();
    }
    for (int k = 0; k < (int)seg.size(); k++) {
      rmqs.emplace_back(structure_t(seg[k].size()));
    }
  }
  void preupdate(int x, int y) { seg[x + sz].push_back(y); }
};
const int INF = 1 << 30;
const int SIZE = 100002;
int S[3], N, M, K;
int X[SIZE][3];
int A[SIZE][3];
int x[SIZE][3];
vector<pair<pair<pair<int, int>, pair<int, int> >, int> > add[SIZE];
vector<pair<pair<pair<int, int>, pair<int, int> >, int> > del[SIZE];
vector<pair<int, int> > point[SIZE];
void cf499_div1_E() {
  scanf("%d %d %d %d %d %d", &S[0], &S[1], &S[2], &N, &M, &K);
  for (int i = 0; i < N; i++) scanf("%d %d %d", &X[i][0], &X[i][1], &X[i][2]);
  for (int i = 0; i < M; i++) scanf("%d %d %d", &A[i][0], &A[i][1], &A[i][2]);
  vector<pair<int, int> > mx(3);
  for (int i = 0; i < 3; i++) mx[i] = {S[i], 1};
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) mx[j].first = min(mx[j].first, X[i][j]);
    for (int j = 0; j < 3; j++) mx[j].second = max(mx[j].second, X[i][j]);
  }
  for (int i = 0; i < M; i++) {
    bool f = true;
    for (int j = 0; j < 3; j++) {
      f &= mx[j].first <= A[i][j] && A[i][j] <= mx[j].second;
    }
    if (f) {
      cout << "INCORRECT\n";
      return;
    }
  }
  for (int i = 0; i < K; i++) {
    scanf("%d %d %d", &x[i][0], &x[i][1], &x[i][2]);
    vector<pair<int, int> > mz(mx);
    for (int j = 0; j < 3; j++) mz[j].first = min(mz[j].first, x[i][j]);
    for (int j = 0; j < 3; j++) mz[j].second = max(mz[j].second, x[i][j]);
    add[mz[0].first].emplace_back(make_pair(mz[1], mz[2]), i);
    del[mz[0].second + 1].emplace_back(make_pair(mz[1], mz[2]), i);
  }
  struct Abel {
    using t1 = int;
    static t1 id1() { return 0; }
    static t1 op1(const t1& l, const t1& r) { return l + r; }
    static t1 inv1(const t1& x) { return -x; }
  };
  SegmentTree2DCompressed<BIT0<Abel>, Abel> seg(SIZE);
  for (int i = 0; i < M; i++) {
    seg.preupdate(A[i][1], A[i][2]);
    point[A[i][0]].emplace_back(A[i][1], A[i][2]);
  }
  seg.build();
  vector<int> sum(K);
  for (int i = 0; i < SIZE; i++) {
    for (auto& p : del[i])
      sum[p.second] -=
          seg.query(p.first.first.first, p.first.first.second + 1,
                    p.first.second.first, p.first.second.second + 1);
    for (auto& p : add[i])
      sum[p.second] +=
          seg.query(p.first.first.first, p.first.first.second + 1,
                    p.first.second.first, p.first.second.second + 1);
    for (auto& p : point[i]) seg.update(p.first, p.second, 1);
  }
  ostringstream os;
  os << "CORRECT\n";
  for (int i = 0; i < K; i++) {
    if (sum[i] != 0) {
      os << "CLOSED\n";
    } else {
      bool f = true;
      for (int j = 0; j < 3; j++) {
        f &= mx[j].first <= x[i][j] && x[i][j] <= mx[j].second;
      }
      os << (f ? "OPEN\n" : "UNKNOWN\n");
    }
  }
  cout << os.str();
}
int main() { cf499_div1_E(); }