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>> points, int ymin, int ymax) {
    we_ = ymin;
    rp_ = ymax;
    int max_x = 0;
    for (auto& p : points) {
      max_x = max(max_x, p.first.x);
    }
    int k = 1;
    while (k <= max_x) k <<= 1;
    jr_.assign(2 * k, {});
    sort(points.begin(), points.end(),
         [](pair<Point2D, int>& rx, pair<Point2D, int>& lz) {
           return rx.first.y < lz.first.y;
         });
    for (auto& p : points) {
      Entry entry;
      entry.y = p.first.y;
      entry.value = p.second;
      jr_[k + p.first.x].Dob(entry);
    }
    Query(1, 0, k);
  }
  int Build(const Point2D& pmin, const Point2D& pmax) {
    int root = 1;
    auto& ehx = jr_[root].ehx();
    auto compare = [](Entry& entry, int y) { return entry.y < y; };
    int ynach =
        lower_bound(ehx.begin(), ehx.end(), pmin.y, compare) - ehx.begin();
    int ykon =
        lower_bound(ehx.begin(), ehx.end(), pmax.y + 1, compare) - ehx.begin();
    return Build(root, 0, jr_.size() / 2, pmin.x, pmax.x + 1, ynach, ykon);
  }

 private:
  struct Entry {
    int y;
    int rx = 0;
    int lz = 0;
    int value;
    int min1, min2;
  };
  class Noda {
   public:
    void Dob(Entry& entry) { ehx_.push_back(entry); }
    void Query(int ymin, int ymax) {
      we_ = ymin;
      rp_ = ymax;
      int min_value = numeric_limits<int>::max();
      for (auto it = ehx_.begin(); it != ehx_.end(); ++it) {
        if (it->y >= we_) {
          min_value = min(min_value, it->value);
          it->min1 = min_value;
        }
      }
      min_value = numeric_limits<int>::max();
      for (auto it = ehx_.rbegin(); it != ehx_.rend(); ++it) {
        if (it->y <= rp_) {
          min_value = min(min_value, it->value);
          it->min2 = min_value;
        }
      }
    }
    vector<Entry>& ehx() { return ehx_; }
    int Build(int nach, int kon) {
      if (ehx_[nach].y >= we_) {
        return ehx_[kon - 1].min1;
      } else {
        return ehx_[nach].min2;
      }
    }

   private:
    vector<Entry> ehx_;
    int we_, rp_;
  };
  int Build(int node, int nach, int kon, int hru, int gtu, int ynach,
            int ykon) {
    if (gtu <= nach || kon <= hru || ynach == ykon) {
      return numeric_limits<int>::max();
    }
    auto& ehx = jr_[node].ehx();
    if (hru <= nach && kon <= gtu) {
      return jr_[node].Build(ynach, ykon);
    }
    int rx_ykon =
        (ykon < ehx.size() ? ehx[ykon].rx : jr_[2 * node].ehx().size());
    int lz_ykon =
        (ykon < ehx.size() ? ehx[ykon].lz : jr_[2 * node + 1].ehx().size());
    int zer = (nach + kon) / 2;
    return min(Build(2 * node, nach, zer, hru, gtu, ehx[ynach].rx, rx_ykon),
               Build(2 * node + 1, zer, kon, hru, gtu, ehx[ynach].lz, lz_ykon));
  }
  void Query(int node, int nach, int kon) {
    if (nach + 1 < kon) {
      int zer = (nach + kon) / 2;
      Query(2 * node, nach, zer);
      Query(2 * node + 1, zer, kon);
      vector<Entry>& rx = jr_[2 * node].ehx();
      vector<Entry>& lz = jr_[2 * node + 1].ehx();
      int i = 0;
      int j = 0;
      while (i < rx.size() || j < lz.size()) {
        if (i < rx.size() && (j == lz.size() || rx[i].y < lz[j].y)) {
          Entry entry = rx[i];
          entry.rx = i;
          entry.lz = j;
          jr_[node].Dob(entry);
          ++i;
        } else {
          Entry entry = lz[j];
          entry.rx = i;
          entry.lz = j;
          jr_[node].Dob(entry);
          ++j;
        }
      }
    }
    jr_[node].Query(we_, rp_);
  }
  vector<Noda> jr_;
  int we_;
  int rp_;
};
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<pair<Point2D, int>> snar_points1;
  vector<pair<Point2D, int>> snar_points2;
  for (int i = 0; i < m; ++i) {
    Point3D p = ReadPoint();
    if (Inside(pmin, pmax, p)) {
      cout << "INCORRECT\n";
      return;
    }
    if (p.z >= pmin.z) {
      snar_points1.push_back({{p.x, p.y}, p.z - pmin.z});
    }
    if (p.z <= pmax.z) {
      snar_points2.push_back({{p.x, p.y}, pmax.z - p.z});
    }
  }
  Storage2D snar1(snar_points1, pmin.y, pmax.y);
  Storage2D snar2(snar_points2, 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
             ? snar1.Build({p1.x, p1.y}, {p2.x, p2.y}) > p2.z - pmin.z
             : snar2.Build({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;
}