Inglorious Gangs

In the Vice City gangs are disturbing people. Gangs usually drive in streets of Vice City in groups of cars. The cops cannot resist because the number of gangs is much greater. Therefore each gang group can be chased by only one cop. But at some intersections in the city, each of the gang cars goes in one direction. The lonely cop will be confused which one to follow, and the gang group escapes. The police officers know the fact that gang groups will only separate if they can gather together again somewhere in the city. They devised a plan and asked the mayor to block some of the roads to prevent the gang groups from separating. Now cops can chase gang groups till they catch them. You are hired to check whether or not the city is well prepared to trap the sinister gangs. Map of the city is in the form of a directed graph where nodes indicate intersections and directed edges are roads of the city. Input In the first line there is T (T ≤ 100), the number of tests. Each test begins with integers N and M (1 ≤ N ≤ 5000, M ≤ 105), the number of intersections and roads in the Vice City. Next M lines are non-blocked roads of Vice City, each of which is a pair of integers u, v (1 ≤ u, v ≤ N, u ̸= v) meaning that there is a road from intersection u to intersection v. Output Print a single word ‘Trapped’ if we can trap the gangs and ‘Not Trapped’ otherwise. (Quotes for clarity) Sample Input 2 33 12 23 13 44 12 23 34 42 Sample Output Not Trapped Trapped