{"raw_statement":[{"iden":"statement","content":"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.\n\nIt 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$.\n\nUnfortunately, Natasha does not know the numbers $x_l,x_r,y_l,y_r,z_l,z_r$.\n\nOne 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.\n\nNatasha 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."},{"iden":"input","content":"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.\n\nThe $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.\n\nThe $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.\n\nThe $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."},{"iden":"output","content":"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).\n\nOtherwise, 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."},{"iden":"examples","content":"Input\n\n10 10 10 3 1 3\n2 6 2\n4 2 4\n6 4 6\n9 9 9\n3 3 3\n10 10 10\n8 8 8\n\nOutput\n\nCORRECT\nOPEN\nCLOSED\nUNKNOWN\n\nInput\n\n10 10 10 1 1 1\n2 5 7\n2 5 7\n8 9 10\n\nOutput\n\nINCORRECT"},{"iden":"note","content":"Consider the first test case.\n\nThere are $10$ months in a year, $10$ days in a month, and $10$ seconds in a day.\n\nThe store was opened in $3$ moments:\n\n*   month $2$, day $6$, second $2$;\n*   month $4$, day $2$, second $4$;\n*   month $6$, day $4$, second $6$.\n\nThe store was closed at the time: month $9$, day $9$, second $9$.\n\nQueries:\n\n*   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$);\n*   month $10$, day $10$, second $10$ — closed (\"_CLOSED_\") (since it is closed even in the month $9$, day $9$, second $9$);\n*   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).\n\nIn the second test case, the store was closed and opened at the same time — contradiction (\"_INCORRECT_\")."}],"translated_statement":[{"iden":"statement","content":"Natasha 已经准备返回地球，但她突然想起还需要去火星商店为朋友们购买火星纪念品。\n\n已知火星的一年有 $x_{max}$ 个月，一个月有 $y_{max}$ 天，一天有 $z_{max}$ 秒。Natasha 还知道这家商店的营业时间安排如下：在一年中选出了两个月份 $x_l$ 和 $x_r$（$1 \\leq x_l \\leq x_r \\leq x_{max}$），在一个月中选出了两天 $y_l$ 和 $y_r$（$1 \\leq y_l \\leq y_r \\leq y_{max}$），在一天中选出了两个时间点 $z_l$ 和 $z_r$（$1 \\leq z_l \\leq z_r \\leq z_{max}$）。商店在所有满足 $x_l \\leq x \\leq x_r$、$y_l \\leq y \\leq y_r$ 且 $z_l \\leq z \\leq z_r$ 的时刻（月份 $x$、天 $y$、秒 $z$）均营业。\n\n不幸的是，Natasha 并不知道 $x_l, x_r, y_l, y_r, z_l, z_r$ 的具体数值。\n\n一位火星人告诉 Natasha：\"我一共去了这家商店 $(n + m)$ 次，其中 $n$ 次商店是开放的，$m$ 次是关闭的。\" 他还描述了每一次到访的时间：每次的月份、天数、秒数，以及当时商店是开放还是关闭。\n\nNatasha 可以去商店 $k$ 次。对于每一次访问，请判断在该时刻商店是开放、关闭，还是信息未知。\n\n第一行包含 $6$ 个整数 $x_{max}$、$y_{max}$、$z_{max}$、$n$、$m$、$k$（$1 \\leq x_{max}, y_{max}, z_{max} \\leq 10^5$，$1 \\leq n \\leq 10^5$，$0 \\leq m \\leq 10^5$，$1 \\leq k \\leq 10^5$）——分别表示一年中的月数、每月的天数、每天的秒数、根据火星人所述商店开放的次数、关闭的次数以及 Natasha 的查询次数。\n\n接下来的 $n$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示第 $i$ 次商店开放的时间（按火星人所述）。\n\n接下来的 $m$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示第 $i$ 次商店关闭的时间（按火星人所述）。\n\n接下来的 $k$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示 Natasha 第 $i$ 次查询的时间。\n\n如果火星人的说法存在矛盾（即商店开放和关闭的时间信息不一致），请输出一行 \"_INCORRECT_\"（不含引号）。\n\n否则，先输出一行 \"_CORRECT_\"（不含引号），然后输出 $k$ 行：对于第 $i$ 个查询，输出 \"_OPEN_\"（不含引号）表示商店在该时刻开放，\"_CLOSED_\" 表示关闭，\"_UNKNOWN_\" 表示根据现有信息无法确定。\n\n考虑第一个测试用例：\n\n一年有 $10$ 个月，每月有 $10$ 天，每天有 $10$ 秒。\n\n商店在以下 $3$ 个时刻开放：\n\n商店在以下时刻关闭：月份 $9$、天 $9$、秒 $9$。\n\n查询：\n\n在第二个测试用例中，商店在同一时刻既被标记为开放又被标记为关闭——矛盾（\"_INCORRECT_\"）。\n\n"},{"iden":"input","content":"第一行包含 $6$ 个整数 $x_{max}$、$y_{max}$、$z_{max}$、$n$、$m$、$k$（$1 \\leq x_{max}, y_{max}, z_{max} \\leq 10^5$，$1 \\leq n \\leq 10^5$，$0 \\leq m \\leq 10^5$，$1 \\leq k \\leq 10^5$）——分别表示一年中的月数、每月的天数、每天的秒数、根据火星人所述商店开放的次数、关闭的次数以及 Natasha 的查询次数。接下来的 $n$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示第 $i$ 次商店开放的时间（按火星人所述）。接下来的 $m$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示第 $i$ 次商店关闭的时间（按火星人所述）。接下来的 $k$ 行，每行包含 $3$ 个整数 $x_i$、$y_i$、$z_i$（$1 \\leq x_i \\leq x_{max}$，$1 \\leq y_i \\leq y_{max}$，$1 \\leq z_i \\leq z_{max}$）——表示 Natasha 第 $i$ 次查询的时间。"},{"iden":"output","content":"如果火星人的说法存在矛盾（即商店开放和关闭的时间信息不一致），请输出一行 \"_INCORRECT_\"（不含引号）。否则，先输出一行 \"_CORRECT_\"（不含引号），然后输出 $k$ 行：对于第 $i$ 个查询，输出 \"_OPEN_\"（不含引号）表示商店在该时刻开放，\"_CLOSED_\" 表示关闭，\"_UNKNOWN_\" 表示根据现有信息无法确定。"},{"iden":"examples","content":"输入10 10 10 3 1 32 6 24 2 46 4 69 9 93 3 310 10 108 8 8输出CORRECTOPENCLOSEDUNKNOWN输入10 10 10 1 1 12 5 72 5 78 9 10输出INCORRECT"},{"iden":"note","content":"考虑第一个测试用例：\n\n一年有 $10$ 个月，每月有 $10$ 天，每天有 $10$ 秒。\n\n商店在以下 $3$ 个时刻开放：月份 $2$、天 $6$、秒 $2$；月份 $4$、天 $2$、秒 $4$；月份 $6$、天 $4$、秒 $6$。\n\n商店在以下时刻关闭：月份 $9$、天 $9$、秒 $9$。\n\n查询：月份 $3$、天 $3$、秒 $3$ —— 开放（\"_OPEN_\"）（因为商店最晚在月份 $2$、天 $2$、秒 $2$ 开始营业，最早在月份 $6$、天 $6$、秒 $6$ 关闭）；月份 $10$、天 $10$、秒 $10$ —— 关闭（\"_CLOSED_\"）（因为在月份 $9$、天 $9$、秒 $9$ 时已经关闭）；月份 $8$、天 $8$、秒 $8$ —— 未知（\"_UNKNOWN_\"）（因为存在一种营业安排使得该时刻开放，也存在另一种安排使得该时刻关闭）。\n\n在第二个测试用例中，商店在同一时刻既被标记为开放又被标记为关闭——矛盾（\"_INCORRECT_\"）。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ X_{\\text{max}}, Y_{\\text{max}}, Z_{\\text{max}} \\in \\mathbb{Z}^+ $ denote the maximum values for months, days, and seconds respectively.  \nLet $ \\mathcal{O} = \\{ (x_i, y_i, z_i) \\}_{i=1}^n \\subseteq [1, X_{\\text{max}}] \\times [1, Y_{\\text{max}}] \\times [1, Z_{\\text{max}}] $ be the set of times the store was observed **open**.  \nLet $ \\mathcal{C} = \\{ (x_i, y_i, z_i) \\}_{i=1}^m \\subseteq [1, X_{\\text{max}}] \\times [1, Y_{\\text{max}}] \\times [1, Z_{\\text{max}}] $ be the set of times the store was observed **closed**.  \nLet $ \\mathcal{Q} = \\{ (x_i, y_i, z_i) \\}_{i=1}^k \\subseteq [1, X_{\\text{max}}] \\times [1, Y_{\\text{max}}] \\times [1, Z_{\\text{max}}] $ be the set of Natasha’s queries.  \n\nThe store operates during a rectangular region:  \n$$\n\\mathcal{R} = [x_l, x_r] \\times [y_l, y_r] \\times [z_l, z_r] \\subseteq [1, X_{\\text{max}}] \\times [1, Y_{\\text{max}}] \\times [1, Z_{\\text{max}}]\n$$  \nfor some integers $ 1 \\le x_l \\le x_r \\le X_{\\text{max}} $, $ 1 \\le y_l \\le y_r \\le Y_{\\text{max}} $, $ 1 \\le z_l \\le z_r \\le Z_{\\text{max}} $.  \n\n**Constraints**  \n1. $ \\mathcal{O} \\subseteq \\mathcal{R} $  \n2. $ \\mathcal{C} \\cap \\mathcal{R} = \\emptyset $  \n3. $ \\mathcal{O} \\cap \\mathcal{C} = \\emptyset $ (no point is both open and closed)  \n\n**Objective**  \n1. If no such region $ \\mathcal{R} $ exists satisfying constraints (1) and (2), output **INCORRECT**.  \n2. Otherwise, output **CORRECT**, and for each query point $ q \\in \\mathcal{Q} $:  \n   - Output **OPEN** if $ q \\in \\mathcal{R} $ for **all** valid $ \\mathcal{R} $,  \n   - Output **CLOSED** if $ q \\notin \\mathcal{R} $ for **all** valid $ \\mathcal{R} $,  \n   - Output **UNKNOWN** otherwise.  \n\n**Region Inference**  \nDefine the minimal bounding box consistent with observations:  \n- $ x_l^* = \\min \\{ x \\mid (x, y, z) \\in \\mathcal{O} \\} $,  \n- $ x_r^* = \\max \\{ x \\mid (x, y, z) \\in \\mathcal{O} \\} $,  \n- $ y_l^* = \\min \\{ y \\mid (x, y, z) \\in \\mathcal{O} \\} $,  \n- $ y_r^* = \\max \\{ y \\mid (x, y, z) \\in \\mathcal{O} \\} $,  \n- $ z_l^* = \\min \\{ z \\mid (x, y, z) \\in \\mathcal{O} \\} $,  \n- $ z_r^* = \\max \\{ z \\mid (x, y, z) \\in \\mathcal{O} \\} $.  \n\nLet $ \\mathcal{R}^* = [x_l^*, x_r^*] \\times [y_l^*, y_r^*] \\times [z_l^*, z_r^*] $.  \n\nThen:  \n- The store is **definitely open** at $ q $ if $ q \\in \\mathcal{R}^* $.  \n- The store is **definitely closed** at $ q $ if $ q \\in \\mathcal{C} $.  \n- The store is **unknown** at $ q $ if $ q \\notin \\mathcal{R}^* $ and $ q \\notin \\mathcal{C} $.  \n\n**Consistency Check**  \nIf $ \\mathcal{R}^* \\cap \\mathcal{C} \\neq \\emptyset $, output **INCORRECT**.  \nOtherwise, output **CORRECT** and classify each query as above.","simple_statement":null,"has_page_source":false}