Beautiful Automata

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Oleksandr is a fan of strings. His favourite data structure is suffix automaton.

Consider a string ss of lowercase English letters. The suffix automaton of ss is the smallest (having the smallest number of vertices) directed acyclic graph GG with a letter l(e)l(e) written on each edge ee and a fixed starting vertex v_0v\_0 such that w,,w is a substring of s=l(e_1)l(e_2)...l(e_k),,(e_1,e_2,...,e_k) is a path in G starting at v_0.\\{w\\, |\\, w \text{ is a substring of } s\\} = \\{l(e\_1)l(e\_2)...l(e\_k)\\, |\\, (e\_1, e\_2, ..., e\_k) \text{ is a path in } G \text{ starting at } v\_0\\}\text{.}

Oleksandr likes suffix automata more than any other graphs. He calls a directed acyclic graph GG ss-beautiful if it is possible to write a lowercase English letter on each edge and choose a starting vertex v_0v\_0 so that GG will become a suffix automaton of the string ss. Oleksandr likes lexicographically small strings, so please help him find for a given graph GG the lexicographically smallest string ss such that GG is ss-beautiful.

입력

The first line contains two integers nn and mm (1n20001 \le n \le 2000, 1m30001 \le m \le 3000), the number of vertices and the number of edges in GG respectively. Each of the next mm lines contains two integers vv and uu (1v,un1 \le v, u \le n, vuv \ne u), denoting a directed edge from vv to uu. It is guaranteed that GG is acyclic.

출력

Output a single line containing the lexicographically smallest string ss consisting of lowercase English letters such that GG is ss-beautiful. If such string does not exist, output 1-1.

힌트

Suffix automata for the first three sample tests are shown below: