// Stephen Fulwider
//	Ranger John's Loops - First Week Programming Contest for BHCSI 2010

// This program uses a DFS to search for cycles in a graph. Essentially we
//	only need to check if we can get back to a node we've already visited
//	(and it's not the one we just came from) to detect a cycle in a graph.
// Be careful here, there is no guarantee that the graph is connected. If
//	the graph were guaranteed to be connected, then we could just check that
//	the number of edges was >= the number of nodes (can you figure out why?).

import java.util.Scanner;


public class loops
{

	public static void main(String[] args)
	{
		new loops();
	}
	
	int N; // number of nodes
	boolean[][] G; // adj. matrix
	
	boolean[] V; // visited array
	
	loops()
	{
		Scanner in=new Scanner(System.in);
		for (int T=in.nextInt(),TC=1; T-->0; ++TC)
		{
			N=in.nextInt();
			G=new boolean[N][N];
			
			for (int E=in.nextInt(); E-->0; )
			{
				int a=in.nextInt()-1; // subtract 1 since we used 0-based indices
				int b=in.nextInt()-1;
				G[a][b]=G[b][a]=true; // turn on the edge in both directions
			}
			
			V=new boolean[N];
			
			// initially we haven't seen a cycle
			boolean cycle=false;
			
			// the graph may be disconnected so we need to search over all nodes and
			//	look for a cycle if we haven't seen this node yet in our dfs
			for (int i=0; i<N && !cycle; ++i)
				if (!V[i])
					cycle |= dfs(i,i);
			
			System.out.printf("Trail Map #%d: Ranger John will ",TC);
			if (cycle)
				System.out.println("enjoy his hike!");
			else
				System.out.println("skip this hike.");
		}
	}
	
	// returns true if we find a cycle, which is basically if we can ever get to a node
	//	that we haven't seen before. store parent so that we completely ignore where we
	//	just came from (remember a cycle must have >= 3 nodes)
	boolean dfs(int at, int parent)
	{
		V[at]=true;
		for (int i=0; i<N; ++i)
			if (G[at][i] && i!=parent) // there is an edge and it isn't the one we just came from
			{
				if (V[i]) // if we've already visited that node, then we just found a cycle
					return true;
				if (dfs(i,at)) // if the dfs on node i with this node as parent finds a cycle, return true
					return true;
			}
		
		// we found no cycle from this node, so just return false
		return false;
	}

}
