eolymp
bolt
Try our new interface for solving problems
Problems

Lucky Cities

Lucky Cities

John has recently arrived in Romania for the South Eastern European Regional competitions. John has never been to Romania before so Romanians decided to organize sightseeing tour for him. This tour will include several Romanian cities and none of them will be visited more than once. John will start in one city and will visit some other cities according to a guide tour. At the end of the tour John will return to the starting point. There are N cities numbered from \textbf{1} to \textbf{N} and \textbf{M} two-way roads in the country. Each road connects two different cities. Consider a sightseeing tour for John \textbf{c_1}, \textbf{c_2}, ..., \textbf{c_n}, where each \textbf{c_i} denotes a city in Romania. Then all \textbf{c_i} must be distinct, \textbf{c_i} and \textbf{c_\{i+1\}} must be connected by a road, where \textbf{i} = \textbf{1}, \textbf{2}, ..., \textbf{n-1}, \textbf{c_n} and \textbf{c_1} must be connected by a road as well. Being a odd person John would like to visit an odd number of cities. The organizers have drawn the plan of all possible tours with an odd number of cities. Residents of the cities would like John to visit them. So if there is at least one tour passing through some city than this city is called lucky. Your task is to calculate the number of lucky cities in Romania. \InputFile The first line of input contains a single integer \textbf{T} - a number of test cases. Every test case starts with a line containing two integers separated by a single space - \textbf{N} and \textbf{M}. Each of the next \textbf{M} lines will contain two integers \textbf{a_i} and \textbf{b_i} separated by a single space - the labels of cities that \textbf{i}-th road connects. Constrains: \textbf{1} ≤ \textbf{T} ≤ \textbf{77}, \textbf{0} ≤ \textbf{N}, \textbf{M} ≤ \textbf{100000}(\textbf{10^5}), \textbf{1} ≤ \textbf{a_i} < \textbf{b_i} ≤ \textbf{N}. \OutputFile Output should contain \textbf{T} lines - answers for each of the test cases.
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
1
7 7
1 5
3 5
3 7
1 7
6 7
4 7
4 6
Output example #1
3