// Arup Guha
// 3/16/2013
// Solution to 2013 FHSPS Problem Night

import java.util.*;
import java.io.*;

public class night {

	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();
			intervallist firstShift = new intervallist();
			intervallist secondShift = new intervallist();

			// Go through each interval.
			for (int i=0; i<numWake; i++) {

				// Read in the first shift.
				time start = new time(stdin.next());
				time end = new time(stdin.next());
				firstShift.add(new interval(start, end));
				i++;

				// Stop if there are no other shifts.
				if (i == numWake) continue;

				// Read in the second shift.
				start = new time(stdin.next());
				end = new time(stdin.next());
				secondShift.add(new interval(start, end));
			}

			// Print result.
			if (firstShift.compareTo(secondShift)  < 0)
				System.out.println("FIRST");
			else
				System.out.println("SECOND");
		}
	}
}

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;
	}
}

class interval {

	private time start;
	private time end;

	public interval(time s, time e) {
		start = s;
		end = e;
	}

	public int duration() {
		return end.getMin() - start.getMin();
	}

	public time getStart() {
		return start;
	}

	public time getEnd() {
		return end;
	}
}

class intervallist {

	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;

	private ArrayList<interval> gaps;

	public intervallist() {
		gaps = new ArrayList<interval>();
	}

	public void add(interval period) {
		gaps.add(period);
	}

	// Returns the duration of all the gaps.
	public int getDuration() {

		int ans = 0;

		for (int i=0; i<gaps.size(); i++)
			ans += gaps.get(i).duration();
		return ans;
	}

	public int getLongestGap() {

		// This is the first gap.
		int max = gaps.get(0).getStart().getMin();

		// Look at the gaps in between wake ups.
		for (int i=1; i<gaps.size(); i++) {
			int cur = gaps.get(i).getStart().getMin() - gaps.get(i-1).getEnd().getMin();
			if (cur > max)
				max = cur;
		}

		// Look at the last gap.
		int last = WHOLE_NIGHT - gaps.get(gaps.size()-1).getEnd().getMin();
		if (last > max)
			max = last;

		// Here is our answer.
		return max;
	}

	// Returns a negative integer if this waking schedule is shorter than other, or if its equal
	// but allows for longer continuous sleep, 0 if these are both ties, and a positive integer
	// otherwise.
	public int compareTo(intervallist other) {

		// Look at duration, return if we can.
		int ans = this.getDuration() - other.getDuration();
		if (ans != 0)
			return ans;

		// Ties are broken by longer duration.
		return other.getLongestGap() - this.getLongestGap();
	}
}

