Insider's Information
Ian works for a rating agency that publishes ratings of the best universities. Irene is a journalist whoplans to write a scandalous article about the upcoming rating.
Using various social engineering techniques (let's not get into more details), Irene received some insider's information from Ian.
Specifically, Irene received several triples (a[i]
, b[i]
, c[i]
), meaning that in the upcoming rating, university b[i]
stands between universities a[i]
and c[i]
. That is, either a[i]
comes before b[i]
which comes before c[i]
, or the opposite. All triples told by Ian are consistent - let's say that actual rating satisfies them all.
To start working on the first draft of the future article, Irene needs to see at least some approximation to the actual rating. She asked you to find a proposal of a rating in which at least half of the triples known by Irene are satisfied.
Input
The first line contains integers n and m (3 ≤ n ≤ 10^5
, 1 ≤ m ≤ 10^5
), the number of rated universities, and the number of triples given to Irene by Ian.
Each of the next m lines contains three distinct integers (1 ≤ a[i]
, b[i]
, c[i]
≤ n) - the universities making a triple.
Output
Output the proposal of a rating from the first university to the last one. The proposal rating should satisfy at least m / 2 triples. If there are many such proposals, output any one of them.
Example
In the example, the first two triples are satisfied whereas the last one is not. Therefore, at least half of all triples are satisfied.