Expressways
Time limit1sMemory limit128 MB
Decide whether some subset of the given roads touches every city an odd number of times.
Problem
Byteland has cities and roads connecting them. The roads are in poor shape, and because of a lack of funds they have not been repaired for a long time.
The residents are demanding that some of the roads be turned into brand-new expressways. The king agrees to build them, but under one condition: there has to be a construction plan in which every one of the cities is served by an odd number of expressways. An expressway can only be built on top of a road that already exists.
Deciding which roads become expressways is the same as choosing a subset of the existing roads. For a given road network, decide whether a plan exists in which every city is incident to an odd number of the chosen roads.
Input
The first line contains a single integer (), the number of test sets. The test sets follow.
The first line of a test set contains two integers and (, ), the number of cities and the number of roads. Each of the next lines contains two integers and (), meaning that cities and are joined by a road. The same pair of cities may be joined by more than one road, and a road may connect a city with itself.
The sum of over all test sets does not exceed , and the sum of does not exceed .
Output
For each test set, print a single line.
Print YES if it is possible to choose a subset of the roads so that every city is incident to an odd number of the chosen roads, and print NO otherwise.