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;
const int MAXN = 1e5 + 5;
int xm, ym, zm, n, m, k;
struct {
  int l, r, lzlow, lztop, lowv, topv;
} tr[MAXN * 4];
void pushdown(int pos) {
  if (tr[pos].l != tr[pos].r) {
    tr[pos << 1].lzlow = max(tr[pos << 1].lzlow, tr[pos].lzlow);
    tr[pos << 1].lowv = max(tr[pos << 1].lowv, tr[pos].lzlow);
    tr[pos << 1].lztop = min(tr[pos << 1].lztop, tr[pos].lztop);
    tr[pos << 1].topv = min(tr[pos << 1].topv, tr[pos].lztop);
    tr[pos << 1 | 1].lzlow = max(tr[pos << 1 | 1].lzlow, tr[pos].lzlow);
    tr[pos << 1 | 1].lowv = max(tr[pos << 1 | 1].lowv, tr[pos].lzlow);
    tr[pos << 1 | 1].lztop = min(tr[pos << 1 | 1].lztop, tr[pos].lztop);
    tr[pos << 1 | 1].topv = min(tr[pos << 1 | 1].topv, tr[pos].lztop);
  }
}
void pushup(int pos) {
  tr[pos].lowv = max(tr[pos << 1].lowv, tr[pos << 1 | 1].lowv);
  tr[pos].topv = min(tr[pos << 1].topv, tr[pos << 1 | 1].topv);
}
void build(int l, int r, int pos) {
  tr[pos].l = l;
  tr[pos].r = r;
  tr[pos].lzlow = -1e9;
  tr[pos].lowv = -1e9;
  tr[pos].lztop = +1e9;
  tr[pos].topv = +1e9;
  if (l != r) {
    int mid = (l + r) / 2;
    build(l, mid, pos << 1);
    build(mid + 1, r, pos << 1 | 1);
  }
}
void update(int l, int r, int lowv, int topv, int pos) {
  pushdown(pos);
  if (tr[pos].l == l && tr[pos].r == r) {
    tr[pos].lzlow = max(tr[pos].lzlow, lowv);
    tr[pos].lowv = max(tr[pos].lowv, lowv);
    tr[pos].lztop = min(tr[pos].lztop, topv);
    tr[pos].topv = min(tr[pos].topv, topv);
    return;
  }
  int mid = tr[pos << 1].r;
  if (r <= mid) {
    update(l, r, lowv, topv, pos << 1);
  } else if (l > mid) {
    update(l, r, lowv, topv, pos << 1 | 1);
  } else {
    update(l, mid, lowv, topv, pos << 1);
    update(mid + 1, r, lowv, topv, pos << 1 | 1);
  }
  pushup(pos);
}
pair<int, int> query(int loc, int pos) {
  pushdown(pos);
  if (tr[pos].l == tr[pos].r) {
    return pair<int, int>(tr[pos].lowv, tr[pos].topv);
  }
  int mid = tr[pos << 1].r;
  pair<int, int> ans;
  if (loc <= mid) {
    ans = query(loc, pos << 1);
  } else {
    ans = query(loc, pos << 1 | 1);
  }
  pushup(pos);
  return ans;
}
struct coord {
  int x, y, z;
  bool operator<(const coord &c) const { return x < c.x; }
};
int xa = 1e9, xb = -1, ya = 1e9, yb = -1, za = 1e9, zb = -1;
vector<coord> open, closed;
vector<coord> lft, mid, rht;
vector<pair<coord, int>> lftq, midq, rhtq;
void fill_point(coord c) {
  int yl, yr, zl, zr;
  if (c.y < ya) {
    yl = 1, yr = c.y;
  } else if (ya <= c.y && c.y <= yb) {
    yl = 1, yr = MAXN;
  } else {
    yl = c.y, yr = MAXN;
  }
  if (c.z < za) {
    zl = c.z, zr = MAXN;
  } else if (za <= c.z && c.z <= zb) {
    zl = MAXN, zr = MAXN;
  } else {
    zl = 0, zr = c.z;
  }
  update(yl, yr, zl, zr, 1);
}
int out[MAXN];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> xm >> ym >> zm >> n >> m >> k;
  while (n--) {
    int x, y, z;
    cin >> x >> y >> z;
    xa = min(xa, x);
    xb = max(xb, x);
    ya = min(ya, y);
    yb = max(yb, y);
    za = min(za, z);
    zb = max(zb, z);
  }
  while (m--) {
    coord c;
    cin >> c.x >> c.y >> c.z;
    if (xa <= c.x && c.x <= xb && ya <= c.y && c.y <= yb && za <= c.z &&
        c.z <= zb) {
      cout << "INCORRECT\n";
      return 0;
    }
    if (c.x < xa) {
      lft.push_back(c);
    } else if (xa <= c.x && c.x <= xb) {
      mid.push_back(c);
    } else {
      rht.push_back(c);
    }
  }
  sort((lft).begin(), (lft).end());
  reverse((lft).begin(), (lft).end());
  sort((rht).begin(), (rht).end());
  for (int a = 0; a < k; a++) {
    coord c;
    cin >> c.x >> c.y >> c.z;
    if (xa <= c.x && c.x <= xb && ya <= c.y && c.y <= yb && za <= c.z &&
        c.z <= zb) {
      out[a] = 2;
    } else if (c.x < xa) {
      lftq.push_back({c, a});
    } else if (xa <= c.x && c.x <= xb) {
      midq.push_back({c, a});
    } else {
      rhtq.push_back({c, a});
    }
  }
  sort((lftq).begin(), (lftq).end());
  reverse((lftq).begin(), (lftq).end());
  sort((rhtq).begin(), (rhtq).end());
  build(1, MAXN, 1);
  for (coord c : mid) {
    fill_point(c);
  }
  for (auto au : midq) {
    pair<int, int> res = query(au.first.y, 1);
    out[au.second] = res.first < au.first.z && au.first.z < res.second;
  }
  for (int a = 0, b = 0; a < (int)rhtq.size(); a++) {
    while (b < (int)rht.size() && rht[b].x <= rhtq[a].first.x) {
      fill_point(rht[b]);
      b++;
    }
    pair<int, int> res = query(rhtq[a].first.y, 1);
    out[rhtq[a].second] =
        res.first < rhtq[a].first.z && rhtq[a].first.z < res.second;
  }
  build(1, MAXN, 1);
  for (coord c : mid) {
    fill_point(c);
  }
  for (int a = 0, b = 0; a < (int)lftq.size(); a++) {
    while (b < (int)lft.size() && lft[b].x >= lftq[a].first.x) {
      fill_point(lft[b]);
      b++;
    }
    pair<int, int> res = query(lftq[a].first.y, 1);
    out[lftq[a].second] =
        res.first < lftq[a].first.z && lftq[a].first.z < res.second;
  }
  cout << "CORRECT\n";
  for (int a = 0; a < k; a++) {
    if (out[a] == 0) {
      cout << "CLOSED\n";
    } else if (out[a] == 1) {
      cout << "UNKNOWN\n";
    } else {
      cout << "OPEN\n";
    }
  }
}