You must schedule n tasks numbered 1 through n. Some tasks have prerequisites: an edge u v means task u must be completed strictly before task v. You want a single ordering of all n tasks that respects every prerequisite.
Many orderings can be valid, so output the lexicographically smallest one: among all valid orderings, choose the sequence that is smallest when compared position by position (i.e., prefer a smaller task number as early as possible). Concretely, at every step, schedule the smallest-numbered task whose prerequisites have all already been scheduled.
If the prerequisites are contradictory (they contain a cycle) so that no valid ordering exists, print the single token CYCLE instead.
Input format
Line 1: two integers n and m \u2014 the number of tasks and the number of prerequisite edges.
Next m lines: two integers u v (1-indexed) meaning task u must come before task v.
Output format
If a valid ordering exists: the n task numbers in lexicographically smallest valid order, separated by single spaces, on one line.
Otherwise: the single token CYCLE.
Constraints
- 1 \u2264 n \u2264 100000
- 0 \u2264 m \u2264 200000
- 1 \u2264 u, v \u2264 n
- An edge may be given more than once;
uandvof an edge may satisfyu == v(a self-edge, which forms a cycle).