// Arup Guha
// 3/12/2018
// Solution to 2018 UCF HS Contest Problem: Order from Chaos

import java.util.*;
import java.io.*;

public class order {

	final public static int MAXNUM = 100001;

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int nC = Integer.parseInt(stdin.readLine().trim());

		// Process each case.
		for (int loop=1; loop<=nC; loop++) {

			// Read in the input - store true for each question number
			int n = Integer.parseInt(stdin.readLine().trim());
			boolean[] list = new boolean[MAXNUM];

			// Set up a String Tokenizer to get all the numbers.
			StringTokenizer tok = new StringTokenizer(stdin.readLine());

			// Mark each of these questions as true.
			for (int i=0; i<n; i++)
				list[Integer.parseInt(tok.nextToken())] = true;

			// Store output here.
			StringBuffer out = new StringBuffer();

			// Sweep through the list.
			int i = 0;
			while (i < MAXNUM) {

				// Get starting of next streak.
				while (i < MAXNUM && !list[i]) i++;
				int start = i;

				// Need to get out.
				if (start == MAXNUM) break;

				// Get ending of next streak.
				while (i < MAXNUM && list[i]) i++;
				int end = i-1;

				// Add to list - tricky since there are two ways to name ranges.
				if (end > start)
					out.append(" "+start+"-"+end+",");
				else
					out.append(" "+start+",");
			}

			// Output.
			System.out.println("Day #"+loop+":"+out.substring(0, out.length()-1));
			System.out.println();
		}
	}
}