// Arup Guha
// 3/16/2013
// Solution to 2013 FHSPS Problem Night

import java.util.*;
import java.io.*;

public class night2 {

	final public static int MIN_PER_HR = 60;
	final public static int NUM_HOURS = 9;
	final public static int WHOLE_NIGHT = NUM_HOURS*MIN_PER_HR;

	final public static boolean DEBUG = false;

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		for (int loop=1; loop<=numCases; loop++) {

			// Read in intervals.
			int numWake = stdin.nextInt();
			time[][] intervals = new time[numWake][2];
			for (int i=0; i<numWake; i++)
				for (int j=0; j<2; j++)
					intervals[i][j] = new time(stdin.next());

			// Get result.
			boolean wakeFirst = isFirstBetter(intervals);

			// Print result.
			if (wakeFirst)
				System.out.println("FIRST");
			else
				System.out.println("SECOND");
		}

	}

	public static boolean isFirstBetter(time[][] intervals) {

		// Loop through each wake up, adding the time to the appropriate counter.
		int minFirst = 0, minSecond = 0;
		for (int i=0; i<intervals.length; i++) {
			if (i%2 == 0)
				minFirst += (intervals[i][1].getMin() - intervals[i][0].getMin());
			else
				minSecond += (intervals[i][1].getMin() - intervals[i][0].getMin());
		}

		if (DEBUG) {
			System.out.println("Awake first = "+minFirst);
			System.out.println("Awake second = "+minSecond);
		}

		// Answer if this slept is unequal.
		if (minFirst < minSecond) return true;
		else if (minFirst > minSecond) return false;

		// Go through, looking for longest duration of sleep.
		int maxFirstDuration = 0, maxSecondDuration = 0;
		int curSleepFirst = 0, curSleepSecond = 0;
		for (int i=0; i<intervals.length; i++) {

			// Process first person waking up.
			if (i%2 == 0) {
				int thisInterval = intervals[i][0].getMin() - curSleepFirst;
				if (thisInterval > maxFirstDuration)
					maxFirstDuration = thisInterval;
				curSleepFirst = intervals[i][1].getMin();
			}

			// Process second person waking up.
			else {
				int thisInterval = intervals[i][0].getMin() - curSleepSecond;
				if (thisInterval > maxSecondDuration)
					maxSecondDuration = thisInterval;
				curSleepSecond = intervals[i][1].getMin();
			}

		}

		// Process last bit of sleep for the first person.
		int lastIntervalFirst = WHOLE_NIGHT - curSleepFirst;
		if (lastIntervalFirst > maxFirstDuration)
			maxFirstDuration = lastIntervalFirst;

		int lastIntervalSecond = WHOLE_NIGHT - curSleepSecond;
		if (lastIntervalSecond > maxSecondDuration)
			maxSecondDuration = lastIntervalSecond;

		if (DEBUG) {
			System.out.println("Continuous first = "+maxFirstDuration);
			System.out.println("Continuous second = "+maxSecondDuration);
		}

		// We can finally break our tie.
		if (maxFirstDuration > maxSecondDuration) return true;
		return false;
	}
}

class time {

	private int minutes;

	public time(String t) {

		// Parse out parts.
		int len = t.length();
		String day = t.substring(len-2,len);
		int min = Integer.parseInt(t.substring(len-4, len-2));
		int hr = Integer.parseInt(t.substring(0, len-5));

		// Set minutes to be offset from 11pm.
		if (day.equals("pm")) {
			minutes = min;
		}

		// Minutes are 60 plus time from midnight.
		else {
			minutes = 60 + min;
			if (hr < 12)
				minutes += (60*hr);
		}
	}

	public int getMin() {
		return minutes;
	}
}