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\le x_l\le x_r\le x_{max}$), 2 days in a month: $y_l$ and $y_r$ ($1\le y_l\le y_r\le y_{max}$) and 2 seconds in a day: $z_l$ and $z_r$ ($1\le z_l\le z_r\le z_{max}$). The store works at all such moments (month $x$, day $y$, second $z$), when simultaneously $x_l\le x\le x_r$, $y_l\le y\le y_r$ and $z_l\le z\le 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.
The first line contains $6$ integers $x_{max}$, $y_{max}$, $z_{max}$, $n$, $m$, $k$ ($1\le x_{max},y_{max},z_{max}\le 10^5$, $1\le n\le 10^5$, $0\le m\le 10^5$, $1\le k\le 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\le x_i\le x_{max}$, $1\le y_i\le y_{max}$, $1\le z_i\le 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\le x_i\le x_{max}$, $1\le y_i\le y_{max}$, $1\le z_i\le 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\le x_i\le x_{max}$, $1\le y_i\le y_{max}$, $1\le z_i\le z_{max}$) — month, day and second of $i$-th Natasha's query.
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

class Timestamp(object):

    def __init__(self, t):
        self.t = t

    def __eq__(self, other):
        return self.t[0] == other.t[0] \
            and self.t[1] == other.t[1] \
            and self.t[2] == other.t[2]
    
    def __ne__(self, other):
        return not self.__eq__(other)

    def __lt__(self, other):
        return self.t[0] < other.t[0] \
            or (self.t[0] == other.t[0] and \
                    (self.t[1] < other.t[1] \
                        or (self.t[1] == other.t[1] and self.t[2] < other.t[2]))) 
    
    def __le__(self, other):
        return self.__eq__(other) or self.__lt__(other)

    def __gt__(self, other):
        return self.__ne__(other) and other.__lt__(self)

    def __ge__(self, other):
        return other.__lt__(self)

    def __len__(self):
        return self.t.__len__()

    def __getitem__(self, i):
        return self.t.__getitem__(i)

    def __str__(self):
        return self.t.__str__()


# месяцев в году, дней в месяце, секунд в сутках
# магазин был открыт, закрыт, тест
x_max, y_max, z_max, n, m, k = [int(t) for t in input().split()]  
t_min = Timestamp([1, 1, 1])
t_max = Timestamp([x_max, y_max, z_max])

def read_timestamps(t):
    times = []
    for _ in range(t):
        t = Timestamp([int(s) for s in input().split()])
        if t_min <= t <= t_max:
            times.append(t)
        else:
            print("INCORRECT")
            exit(0)
    return times

def radix_sort(arr):
    b = [None] * len(arr)
    for i in range(3):  # цикл по месяцам, дням, секундам
        c = [0] * t_max.t[i]  # разряды
        for a in arr:  # сколько чисел каждого разряда
            c[a[i] - 1] += 1
        count = 0
        for j in range(t_max.t[i]):  # кумулятивная сумма
            tmp = c[j]
            c[j] = count
            count += tmp
        for a in arr:  # заполняем по разрядам
            b[c[a[i] - 1]] = a
            c[a[i] - 1] += 1
    return b

times_opened = radix_sort(read_timestamps(n))
times_closed = read_timestamps(m)
test = read_timestamps(k)

open_l = times_opened[0]
open_r = times_opened[-1]

closed_l = []
closed_r = []
for t in times_closed:
    if open_l <= t <= open_r:
        print("INCORRECT")
        exit(0)
    elif t < open_l:
        closed_l.append(t)
    else:
        closed_r.append(t)
closed_l = radix_sort(closed_l)
closed_r = radix_sort(closed_r)
print("CORRECT")

if closed_l:
    cl_l = t_min #closed_l[-1]
    cl_r = closed_l[0]
else:
    cl_l = t_min
    cl_r = t_min

if closed_r:
    cr_l = closed_r[0]
    cr_r = t_max #closed_r[-1]
    print(cr_r, cr_l)
else:
    cr_l = t_max
    cr_r = t_max

for t in test:
    #print(t)
    if open_l <= t <= open_r:
        print("OPEN")
    elif cl_l <= t <= cl_r or cr_l <= t <= cr_r:
        print("CLOSED")
    else:
        print("UNKNOWN")
        print(cl_l, t, cl_r)
        print(cr_l, t, cr_r)
