// Skyler Goodell
// 7/25/2011
// Solution to 2011 BHCSI Contest Question: Iron Coder

import java.util.*;
import java.io.*;

public class ironcoder {
	
	public static void main(String[] args) throws Exception
	{
		Scanner input = new Scanner(new File("ironcoder.in"));

		// Get the number of cases.		
		int N = input.nextInt();
		
		// Read through each case.
		for (int n = 1; n <= N; n++)
		{
			
			// Parameters for this case.
			int C = input.nextInt();
			int T = input.nextInt();
			
			master[] masters = new master[T];
			
			for (int t = 0; t < T; t++)
				masters[t] = new master(input.next(), input.nextInt());
			
			// Sort the list.
			Arrays.sort(masters);
			
			// Pick out the median, as defined by this question.
			int mid = masters.length/2;
			System.out.print("The challenger will face " + masters[mid].name + ": The challenger ");
			
			if (C > masters[mid].score)
				System.out.println("wins!");
			else
				System.out.println("loses.");
		}
	}
	
	private static class master implements Comparable<master>
	{
		public String name;
		public int score;
		
		public master(String name, int score)
		{
			this.name = name;
			this.score = score;
		}

		@Override
		public int compareTo(master o) {
			if (score < o.score)
				return -1;
			else if (score > o.score)
				return 1;
			else
				return 0;
		}
	}
}
