Departure
As the departure time nears, it's crucial to organize the seating for each LKSHe child by assigning them to one of the two buses heading to Moscow. This year, the buses are so spacious that each can carry all the LKSHe children.
There will be exactly two buses. Why two? Because for some pairs of LKSHe children, it's essential that they do not share the same bus. Conversely, for other pairs, they must be seated on the same bus.
Your task is to help us assign the LKSHe children to the buses.
Input
The first line of the input provides the number n (1 ≤ n ≤ 10000), representing the total number of LKSHe children. The second line gives the number m (1 ≤ m ≤ 100000), which is the number of pairs of children that require special attention when assigning them to buses. The following m lines each contain three integers i, j, and k (1 ≤ i, j ≤ n; 1 ≤ k ≤ 2). If k is one, then children i and j must be on the same bus. If k is two, then they must be on different buses.
Output
On the first line of the output, print the number of children assigned to the first bus. On the second line, list the numbers of the LKSHe children who will be on the first bus, separated by spaces. If it's impossible to arrange the seating according to the rules, print -1. If there are multiple valid arrangements, you may print any one of them.