#D6913. iff

    ID: 5745 Type: Default 1000ms 268MiB

iff

iff

problem

There are N N propositions, named 1,2, cdots,N 1, 2, \ cdots, N , respectively. Also, M M information about the propositions is given. The i i th information is "ai a_i ".Givenintheform"bi". Given in the form "b_i ", which means that ai a_i is bi b_i . ("If" is a logical conditional and the transition law holds.) Foreachproposition For each proposition i $ Output all propositions that have the same value as i $ in ascending order. However, proposition i i and proposition i i are always the same value. Proposition X X and proposition Y Y have the same value as "if if X ".Itmeans"Y". It means "Y " and "X X if Y Y ".

output

On the i i line, output all propositions that have the same value as the proposition i i , separated by blanks in ascending order. Also, output a line break at the end of each line.

Example

Input

5 2 1 2 2 1

Output

1 2 1 2 3 4 5

inputFormat

outputFormat

Output all propositions that have the same value as i inascendingorder.However,proposition in ascending order. However, proposition i andproposition and proposition i arealwaysthesamevalue.Proposition are always the same value. Proposition X andproposition and proposition Y havethesamevalueas" have the same value as " if X X ". It means "Y "and"" and " X if if Y $".

output

On the i i line, output all propositions that have the same value as the proposition i i , separated by blanks in ascending order. Also, output a line break at the end of each line.

Example

Input

5 2 1 2 2 1

Output

1 2 1 2 3 4 5

样例

5 2
1 2
2 1
1 2

1 2 3 4 5

</p>