QOJ.ac

QOJ

実行時間制限: 0.7 s メモリ制限: 512 MB 満点: 100

#5191. Chaotic Evil

統計

Background

Problem setters are divided into 9 alignments: Lawful Good, Lawful Neutral, Lawful Evil, Neutral Good, True Neutral, Neutral Evil, Chaotic Good, Chaotic Neutral, and Chaotic Evil. A true problem setter must be able to switch between these alignments without losing themselves in the realm.

The realm is an infinite triangular grid. As shown in the figure below, each intersection has 6 adjacent intersections. You start at a certain intersection, and each time you set a style for a problem idea, you move one step in the realm.

Each problem setter has a Lawfulness index $L$ and a Goodness index $G$. For each idea, you can choose exactly one of the 6 directions as the unique style of the problem, which corresponds to moving one step in the realm along the chosen arrow:

You have $n$ ideas in total, and you know how your $L$ and $G$ indices change when you set a specific style for each idea. Specifically, for the $i$-th idea, there are 12 parameters: $tl_{i,l}, tl_{i,g}, l_{i,l}, l_{i,g}, bl_{i,l}, bl_{i,g}, br_{i,l}, br_{i,g}, r_{i,l}, r_{i,g}, tr_{i,l}, tr_{i,g}$.

If you choose "Concise Problem Statement", $L$ becomes $L+tl_{i,l}$ and $G$ becomes $G+tl_{i,g}$.

If you choose "Trivial Useless Sample", $L$ becomes $L+l_{i,l}$ and $G$ becomes $G+l_{i,g}$.

If you choose "Loose Data Range", $L$ becomes $L+bl_{i,l}$ and $G$ becomes $G+bl_{i,g}$.

If you choose "Complex Problem Statement", $L$ becomes $L+br_{i,l}$ and $G$ becomes $G+br_{i,g}$.

If you choose "Selfless Gift Sample", $L$ becomes $L+r_{i,l}$ and $G$ becomes $G+r_{i,g}$.

If you choose "Very Loose Data Range", $L$ becomes $L+tr_{i,l}$ and $G$ becomes $G+tr_{i,g}$.

All additions are performed modulo $p$.

The requirements to enter the Chaotic Evil alignment are strict: $L$ must be exactly $L^*$ and $G$ must be exactly $G^*$.

Your $L$ and $G$ indices both start at $0$. Determine if there exists a way to set the styles for all $n$ ideas such that you return to your original position in the realm while also entering the Chaotic Evil alignment.

Input

The first line contains two positive integers $n, p$.

The next $n$ lines each contain 12 non-negative integers: $tl_{i,l}, tl_{i,g}, l_{i,l}, l_{i,g}, bl_{i,l}, bl_{i,g}, br_{i,l}, br_{i,g}, r_{i,l}, r_{i,g}, tr_{i,l}, tr_{i,g}$. The order of the parameters is consistent with the description.

The last line contains two non-negative integers $L^*, G^*$.

Output

If it is possible, output Chaotic Evil.

If it is not possible, output Not a true problem setter.

Examples

Input 1

3 10
3 5 1 4 9 3 0 0 0 0 0 0
0 0 0 0 0 0 3 5 1 4 9 3
3 5 1 4 9 3 3 5 1 4 9 3
3 2

Output 1

Chaotic Evil

Note 1

Set the style of the 1st idea to "Concise Problem Statement"; your Lawfulness index becomes $0+3=3$ and your Goodness index becomes $0+5=5$. You move one step to the top-left.

Set the style of the 3rd idea to "Loose Data Range"; your Lawfulness index becomes $3+9=2$ and your Goodness index becomes $5+3=8$. You move one step to the bottom-left.

Set the style of the 2nd idea to "Selfless Gift Sample"; your Lawfulness index becomes $2+1=3$ and your Goodness index becomes $8+4=2$. You move one step to the right. At this point, you have returned to the origin, your Lawfulness index is $3$, and your Goodness index is $2$. Therefore, you can enter the Chaotic Evil alignment.

Subtasks

It is guaranteed that $n \le 100$ and $p \le 100$.

All other input data are between $0$ and $p-1$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.