There are participants at 插入编程竞赛 which need to be accommodated in a hotel with available rooms.
Among these participants there are exactly friendships. If two participants are friends, then they can be assigned to the same room. Otherwise, they must be assigned to different rooms.
Task
Find the lexicographically minimum assignment of the participants to the available rooms of the hotel. We can show that such an assignment always exists.
An assignment is lexicographically smaller than another assignment if there exists a position for which:
- , for all .
- .
Here, denotes the number of the room assigned to the -th participant in the first assignment. Similarly, denotes the number of the room assigned to the -th participant in the second assignment.
Input data
The first line of input containts integers and - the number of participants, and the number of friendships, respectively.
Each of the next lines of input contains two integers and (, ), meaning that participants and are friends. Note that this relationship is bidirectional.
Output data
Print the lexicographically minimum assignment ( for all ). We can show that such an assignment always exists.
Constraints and clarifications
- , for all
- It is guaranteed that all friendships given in the input are pairwise distinct.
| # | Score | Constraints |
|---|---|---|
| 1 | 14 | |
| 2 | 19 | |
| 3 | 31 | |
| 4 | 36 | No additional restrictions |
Example 1
stdin
6 4
1 4
1 5
3 5
6 2
stdout
1 2 3 1 3 2
Explanation
Participant is assigned to room .
Participant is assigned to room .
Participant is assigned to room .
Participant is assigned to room .
Participant is assigned to room .
Participant is assigned to room .
For example, since participants and are friends, they can be assigned to the same room.
We can show that, under the given constratints, this is the lexicographically minimum assignment.
Example 2
stdin
4 6
1 2
1 3
1 4
2 3
2 4
3 4
stdout
1 1 1 1
Explanation
Here, all of the participants are friends with each other. Therefore, they can all be assigned to room .