Odd-Length Cycle

No attempts yetTime limit1sMemory limit128 MB

Problem

Given an undirected graph, determine whether it contains a cycle of odd length.

You are given a number tt of test cases, followed by tt graphs. For each graph, decide whether an odd-length cycle exists in it.

Input

The first line contains the number of test cases tt (1t1001 \le t \le 100). Then tt undirected graphs follow.

Each graph starts with two integers nn and mm, the number of vertices and the number of edges (1n1051 \le n \le 10^5, 1m2×1051 \le m \le 2 \times 10^5). Each of the next mm lines contains two integers between 11 and nn, the two endpoints of one edge.

Output

For each graph, print the answer on its own line. Print TAK if the graph contains a cycle of odd length (equivalently, the graph is not bipartite), and NIE otherwise.