// Arup Guha
// 2/7/2013
// Solution to COP 3503 Recitation Program #2: AVL Tree Heist.
import java.util.*;

public class avl {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int numCases = stdin.nextInt();

		// Go through all cases.
		for (int loop=1; loop<=numCases; loop++) {

			int numNodes = stdin.nextInt();
			BinTreeNode root = null;

			// Insert each node.
			boolean result = true;
			for (int i=0; i<numNodes; i++) {

				int nextVal = stdin.nextInt();

				// No need to physically insert nodes after we know the result.
				if (!result) continue;

				// Special case for empty tree.
				if (i == 0)
					root = new BinTreeNode(nextVal);

				// Typical insert, see if imbalance occurs.
				else {
					boolean temp = root.insert(nextVal);
					result = temp && result;
				}
			}

			// Print the answer.
			if (result)
				System.out.println("Tree #"+loop+": KEEP");
			else
				System.out.println("Tree #"+loop+": REMOVE");

		}
	}
}

class BinTreeNode {

	private int value;
	private BinTreeNode left;
	private BinTreeNode right;
	private int height;

	// Set up a new node in a tree of size 1 node.
	public BinTreeNode(int num) {
		value = num;
		left = null;
		right = null;
		height = 0;
	}

	// Returns true if the AVL tree property is maintained after the
	// insert, false otherwise.
	public boolean insert(int num) {

		boolean ans = true;

		// Insert to the left.
		if (num < value) {

			// We place the node here.
			if (left == null) {
				left = new BinTreeNode(num);
				if (right == null)
					height = 1;
			}

			// There's a left subtree, so insert recursively.
			else {
				ans = left.insert(num) && ans;
				if (right == null || left.height > right.height)
					height = left.height+1;
			}

		}

		// Insert to the right.
		else {

			// We place the node here.
			if (right == null) {
				right = new BinTreeNode(num);
				if (left == null)
					height = 1;
			}

			// There's a right subtree, so insert recursively.
			else {
				ans = right.insert(num) && ans;
				if (left == null || right.height > left.height)
					height = right.height + 1;
			}

		}

		// Problem occurred earlier in the tree.
		if (!ans) return false;

		// Set heights of left and right subtrees.
		int lHeight=-1, rHeight=-1;
		if (left != null) lHeight = left.height;
		if (right != null) rHeight = right.height;

		// Return if this node is balanced.
		return Math.abs(lHeight - rHeight) < 2;

	}
}
