The city council wants to run a sightseeing bus tour through the city so that tourists can see every corner of it. The tour must be planned so that every street is driven along exactly once, and the bus must start and finish at the same junction. Streets are either one-way or two-way, and the tour bus must obey these traffic rules. Determine whether such a sightseeing tour can be constructed.
The first line contains a single positive integer n, the number of test scenarios.
Each scenario begins with a line containing two positive integers m and s (1≤m≤200, 1≤s≤1000): the number of junctions and the number of streets.
Each of the next s lines describes one street with three integers xi, yi, and di (1≤xi,yi≤m, 0≤di≤1), where xi and yi are the junctions joined by the street. If di=1 the street is one-way (from xi to yi); otherwise it is two-way. You may assume there is a junction from which every other junction can be reached.
For each scenario, output a single line containing possible if a sightseeing tour can be constructed, or impossible otherwise.