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;
using int64 = long long int;
struct Point3D {
  int x, y, z;
};
Point3D ReadPoint() {
  Point3D p;
  scanf("%d %d %d", &p.x, &p.y, &p.z);
  --p.x, --p.y, --p.z;
  return p;
}
Point3D Min(Point3D& p1, Point3D& p2) {
  return {min(p1.x, p2.x), min(p1.y, p2.y), min(p1.z, p2.z)};
}
Point3D Max(Point3D& p1, Point3D& p2) {
  return {max(p1.x, p2.x), max(p1.y, p2.y), max(p1.z, p2.z)};
}
struct Point2D {
  int x, y;
};
class Storage2D {
 public:
  Storage2D(vector<pair<Point2D, int>> hwe, int ymin, int ymax) {
    ymin_ = ymin;
    ymax_ = ymax;
    int max_x = 0;
    for (auto& p : hwe) {
      max_x = max(max_x, p.first.x);
    }
    int k = 1;
    while (k <= max_x) k <<= 1;
    xs_.assign(2 * k, {});
    Build(1, 0, k, 0, hwe.size(), hwe);
  }
  int GM(const Point2D& pmin, const Point2D& pmax) {
    int root = 1;
    auto& entries = xs_[root].entries;
    auto compare = [](Entry& entry, int y) { return entry.y < y; };
    int zh = lower_bound(entries.begin(), entries.end(), pmin.y, compare) -
             entries.begin();
    int ag = lower_bound(entries.begin(), entries.end(), pmax.y + 1, compare) -
             entries.begin();
    return GM(root, 0, xs_.size() / 2, pmin.x, pmax.x + 1, zh, ag);
  }

 private:
  struct Entry {
    int y;
    int left;
    int right;
    int value;
    int min1, min2;
  };
  struct Node {
    vector<Entry> entries;
  };
  int GM(int x, int r, int rd, int xr, int xrd, int zh, int ag) {
    if (xrd <= r || rd <= xr || zh == ag) {
      return numeric_limits<int>::max();
    }
    auto& entries = xs_[x].entries;
    if (xr <= r && rd <= xrd) {
      if (xs_[x].entries[zh].y >= ymin_) {
        return entries[ag - 1].min1;
      } else {
        return entries[zh].min2;
      }
    }
    int left_ag =
        (ag < entries.size() ? entries[ag].left : xs_[2 * x].entries.size());
    int right_ag = (ag < entries.size() ? entries[ag].right
                                        : xs_[2 * x + 1].entries.size());
    int middle = (r + rd) / 2;
    return min(GM(2 * x, r, middle, xr, xrd, entries[zh].left, left_ag),
               GM(2 * x + 1, middle, rd, xr, xrd, entries[zh].right, right_ag));
  }
  void Build(int x, int r, int rd, int pr, int prd,
             vector<pair<Point2D, int>>& hwe) {
    vector<Entry>& entries = xs_[x].entries;
    if (r + 1 < rd) {
      int middle = (r + rd) / 2;
      int pmiddle = pr;
      for (int i = pr; i < prd; ++i) {
        if (hwe[i].first.x < middle) {
          swap(hwe[pmiddle++], hwe[i]);
        }
      }
      Build(2 * x, r, middle, pr, pmiddle, hwe);
      Build(2 * x + 1, middle, rd, pmiddle, prd, hwe);
      vector<Entry>& left = xs_[2 * x].entries;
      vector<Entry>& right = xs_[2 * x + 1].entries;
      int i = 0;
      int j = 0;
      while (i < left.size() || j < right.size()) {
        if (i < left.size() && (j == right.size() || left[i].y < right[j].y)) {
          entries.push_back({left[i].y, i, j, left[i].value, 0});
          ++i;
        } else {
          entries.push_back({right[j].y, i, j, right[j].value, 0});
          ++j;
        }
      }
    } else {
      for (int i = pr; i < prd; ++i) {
        entries.push_back({hwe[i].first.y, 0, 0, hwe[i].second, 0});
      }
      sort(entries.begin(), entries.end(),
           [](Entry& left, Entry& right) { return left.y < right.y; });
    }
    int miv = numeric_limits<int>::max();
    for (auto it = entries.begin(); it != entries.end(); ++it) {
      if (it->y >= ymin_) {
        miv = min(miv, it->value);
        it->min1 = miv;
      }
    }
    miv = numeric_limits<int>::max();
    for (auto it = entries.rbegin(); it != entries.rend(); ++it) {
      if (it->y <= ymax_) {
        miv = min(miv, it->value);
        it->min2 = miv;
      }
    }
  }
  vector<Node> xs_;
  int ymin_;
  int ymax_;
};
bool Inside(Point3D& pmin, Point3D& pmax, Point3D& p) {
  return pmin.x <= p.x && p.x <= pmax.x && pmin.y <= p.y && p.y <= pmax.y &&
         pmin.z <= p.z && p.z <= pmax.z;
}
void solve() {
  Point3D r = ReadPoint();
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  Point3D pmin = r;
  Point3D pmax = {0, 0, 0};
  for (int i = 0; i < n; ++i) {
    Point3D p = ReadPoint();
    pmin = Min(pmin, p);
    pmax = Max(pmax, p);
  }
  vector<Point3D> outside_hwe;
  vector<pair<Point2D, int>> outside_hwe1;
  vector<pair<Point2D, int>> outside_hwe2;
  for (int i = 0; i < m; ++i) {
    Point3D p = ReadPoint();
    if (Inside(pmin, pmax, p)) {
      cout << "INCORRECT\n";
      return;
    }
    outside_hwe.push_back(p);
    if (p.z >= pmin.z) {
      outside_hwe1.push_back({{p.x, p.y}, p.z - pmin.z});
    }
    if (p.z <= pmax.z) {
      outside_hwe2.push_back({{p.x, p.y}, pmax.z - p.z});
    }
  }
  Storage2D outside1(outside_hwe1, pmin.y, pmax.y);
  Storage2D outside2(outside_hwe2, pmin.y, pmax.y);
  cout << "CORRECT\n";
  for (int i = 0; i < k; ++i) {
    Point3D p = ReadPoint();
    Point3D p1 = Min(p, pmin);
    Point3D p2 = Max(p, pmax);
    bool can_be_closed = !Inside(pmin, pmax, p);
    bool can_be_open =
        (p1.z >= pmin.z
             ? outside1.GM({p1.x, p1.y}, {p2.x, p2.y}) > p2.z - pmin.z
             : outside2.GM({p1.x, p1.y}, {p2.x, p2.y}) > pmax.z - p1.z);
    if (can_be_open && can_be_closed) {
      cout << "UNKNOWN\n";
    } else if (can_be_open) {
      cout << "OPEN\n";
    } else {
      cout << "CLOSED\n";
    }
  }
}
int main() {
  solve();
  return 0;
}