Manhunt

No attempts yetTime limit1sMemory limit128 MB

Problem

As is well known, Byteotia has nn cities connected by mm two-way roads. In this task the roads serve not only law-abiding citizens but also a dangerous criminal.

For some time a manhunt has been underway in Byteotia to bring the criminal to justice. For now, however, the scoundrel still enjoys his undeserved freedom. He spends each day hidden in one of the cities, and during the night he secretly slips along one of the mm roads to a neighboring city. He never stays in the same city on two consecutive days.

Right now nothing is known about his whereabouts. Into action steps Lieutenant Bytewicz, who has cracked far tougher cases than this. During a day he can comb through one city and will easily seize the villain, provided the villain happens to be in that very city. At night, using a helicopter, he can move to any other city. The manhunt is made harder by the fact that the criminal knows in advance exactly which city the Lieutenant will search on each day, so he has resolved to slip away for as long as he possibly can.

Does Lieutenant Bytewicz stand a chance of catching the criminal? More precisely, is there a strategy for the Lieutenant that guarantees a capture? If so, how few days at minimum does he need to achieve it?

Input

The first line of input contains a single integer tt (1t151 \le t \le 15), the number of test cases, which are then described one after another.

The description of one test case begins with two integers nn and mm (1n750001 \le n \le 75\,000, 0m750000 \le m \le 75\,000), the number of cities and the number of roads connecting them. Cities are numbered from 11 to nn. Each of the next mm lines contains two integers aia_i and bib_i (1ai<bin1 \le a_i < b_i \le n), meaning that cities aia_i and bib_i are joined by a two-way road. No pair of cities is joined by more than one direct road, and the road network makes it possible to travel from every city to every other city.

Output

For each test case, the first line of output should contain the word TAK if a strategy that catches the criminal exists, or NIE otherwise. The second line should contain exactly one integer. If a strategy exists, this integer should equal the minimum number of days the Lieutenant needs to catch the bandit, assuming the criminal knows his moves in advance. Otherwise, the second line should contain the number 1-1.

Hint

Explanation for the third test case in the example: the Lieutenant can comb the cities numbered 22, 44, 44, and 22 in that order. Then the wrongdoer has no chance of escape.