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;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return {i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ld = long double;
using ll = long long;
constexpr int mod = 1000 * 1000 * 1000 + 7;
constexpr int odw2 = (mod + 1) / 2;
void OdejmijOd(int& a, int b) {
  a -= b;
  if (a < 0) a += mod;
}
int Odejmij(int a, int b) {
  OdejmijOd(a, b);
  return a;
}
void DodajDo(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int Dodaj(int a, int b) {
  DodajDo(a, b);
  return a;
}
int Mnoz(int a, int b) { return (ll)a * b % mod; }
void MnozDo(int& a, int b) { a = Mnoz(a, b); }
int Pot(int a, int b) {
  int res = 1;
  while (b) {
    if (b % 2 == 1) MnozDo(res, a);
    a = Mnoz(a, a);
    b /= 2;
  }
  return res;
}
int Odw(int a) { return Pot(a, mod - 2); }
void PodzielDo(int& a, int b) { MnozDo(a, Odw(b)); }
int Podziel(int a, int b) { return Mnoz(a, Odw(b)); }
int Moduluj(ll x) {
  x %= mod;
  if (x < 0) x += mod;
  return x;
}
template <typename T>
T Maxi(T& a, T b) {
  return a = max(a, b);
}
template <typename T>
T Mini(T& a, T b) {
  return a = min(a, b);
}
struct Node {
  vector<int> wsp;
  vector<int> drz;
  void Init() {
    sort(wsp.begin(), wsp.end());
    wsp.resize(unique(wsp.begin(), wsp.end()) - wsp.begin());
    drz.resize(wsp.size() + 1);
  }
  int Pref(int w) {
    w = upper_bound(wsp.begin(), wsp.end(), w) - wsp.begin();
    int sum = 0;
    while (w > 0) {
      sum += drz[w];
      w -= (w & (-w));
    }
    return sum;
  }
  void Dodaj(int w) {
    w = lower_bound(wsp.begin(), wsp.end(), w) - wsp.begin() + 1;
    while (w < (int)drz.size()) {
      drz[w]++;
      w += (w & (-w));
    }
  }
  int Sumuj(int a, int b) { return Pref(b) - Pref(a - 1); }
};
vector<Node> drz;
int X, Y, Z;
int n, m, k;
vector<string> odp;
constexpr int nax = 100 * 1000 + 105;
vector<pair<int, int>> punkty[nax];
vector<pair<int, pair<pair<int, int>, pair<int, int>>>> otw[nax], zam[nax];
vector<int> ys;
vector<int> cnt;
int Pref(int x1, int x2, int y) {
  y = upper_bound(ys.begin(), ys.end(), y) - ys.begin();
  int sum = 0;
  while (y > 0) {
    sum += drz[y].Sumuj(x1, x2);
    y -= (y & (-y));
  }
  return sum;
}
int Sumuj(int x1, int x2, int y1, int y2) {
  const int res = Pref(x1, x2, y2) - Pref(x1, x2, y1 - 1);
  debug() << "Sumuj("
             " ["
             "x1"
             ": "
          << (x1)
          << "] "
             " ["
             "x2"
             ": "
          << (x2)
          << "] "
             " ["
             "y1"
             ": "
          << (y1)
          << "] "
             " ["
             "y2"
             ": "
          << (y2)
          << "] "
             ") = "
          << res;
  return res;
}
void Dodaj(int x, int y, bool naprawde) {
  debug() << "Dodaj("
             " ["
             "x"
             ": "
          << (x)
          << "] "
             " ["
             "y"
             ": "
          << (y)
          << "] "
             " ["
             "naprawde"
             ": "
          << (naprawde)
          << "] "
             ")";
  y = lower_bound(ys.begin(), ys.end(), y) - ys.begin() + 1;
  while (y < (int)drz.size()) {
    if (naprawde) {
      drz[y].Dodaj(x);
    } else {
      drz[y].wsp.push_back(x);
    }
    y += (y & (-y));
  }
}
void algos() {
  for (int i = 1; i <= Z; i++) {
    for (auto& it : punkty[i]) {
      ys.push_back(it.second);
    }
  }
  sort(ys.begin(), ys.end());
  ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
  drz.resize(ys.size() + 1);
  debug() << " ["
             "ys"
             ": "
          << (ys) << "] ";
  for (int i = 1; i <= Z; i++) {
    for (auto& it : punkty[i]) {
      Dodaj(it.first, it.second, false);
    }
  }
  for (Node& node : drz) {
    node.Init();
  }
  for (int i = 1; i <= Z; i++) {
    for (auto& it : otw[i]) {
      cnt[it.first] -= Sumuj(it.second.first.first, it.second.first.second,
                             it.second.second.first, it.second.second.second);
    }
    for (auto& it : punkty[i]) {
      Dodaj(it.first, it.second, true);
    }
    for (auto& it : zam[i]) {
      cnt[it.first] += Sumuj(it.second.first.first, it.second.first.second,
                             it.second.second.first, it.second.second.second);
      assert(cnt[it.first] >= 0);
      if (cnt[it.first] == 0) {
        odp[it.first] = "UNKNOWN";
      } else {
        odp[it.first] = "CLOSED";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> X >> Y >> Z >> n >> m >> k;
  int x[2] = {X, 1};
  int y[2] = {Y, 1};
  int z[2] = {Z, 1};
  for (int i = 0; i < n; i++) {
    int xx, yy, zz;
    cin >> xx >> yy >> zz;
    Mini(x[0], xx);
    Maxi(x[1], xx);
    Mini(y[0], yy);
    Maxi(y[1], yy);
    Mini(z[0], zz);
    Maxi(z[1], zz);
  }
  for (int i = 0; i < m; i++) {
    int xx, yy, zz;
    cin >> xx >> yy >> zz;
    if (x[0] <= xx and xx <= x[1] and y[0] <= yy and yy <= y[1] and
        z[0] <= zz and zz <= z[1]) {
      cout << "INCORRECT" << endl;
      return 0;
    }
    punkty[zz].emplace_back(xx, yy);
  }
  cout << "CORRECT" << endl;
  odp.resize(k);
  cnt.resize(k);
  for (int i = 0; i < k; i++) {
    int xx, yy, zz;
    cin >> xx >> yy >> zz;
    if (x[0] <= xx and xx <= x[1] and y[0] <= yy and yy <= y[1] and
        z[0] <= zz and zz <= z[1]) {
      odp[i] = "OPEN";
    } else {
      int xxx[2] = {x[0], x[1]};
      int yyy[2] = {y[0], y[1]};
      int zzz[2] = {z[0], z[1]};
      Mini(xxx[0], xx);
      Maxi(xxx[1], xx);
      Mini(yyy[0], yy);
      Maxi(yyy[1], yy);
      Mini(zzz[0], zz);
      Maxi(zzz[1], zz);
      debug() << " ["
                 "xxx[0]"
                 ": "
              << (xxx[0])
              << "] "
                 " ["
                 "xxx[1]"
                 ": "
              << (xxx[1])
              << "] "
                 " ["
                 "yyy[0]"
                 ": "
              << (yyy[0])
              << "] "
                 " ["
                 "yyy[1]"
                 ": "
              << (yyy[1])
              << "] "
                 " ["
                 "zzz[0]"
                 ": "
              << (zzz[0])
              << "] "
                 " ["
                 "zzz[1]"
                 ": "
              << (zzz[1]) << "] ";
      otw[zzz[0]].emplace_back(
          i, make_pair(make_pair(xxx[0], xxx[1]), make_pair(yyy[0], yyy[1])));
      zam[zzz[1]].emplace_back(
          i, make_pair(make_pair(xxx[0], xxx[1]), make_pair(yyy[0], yyy[1])));
    }
  }
  algos();
  for (int i = 0; i < k; i++) {
    cout << odp[i] << '\n';
  }
  return 0;
}