// Arup Guha
// 1/11/2022
// Solution to 2016 UCF HS Problem: Disc Jockey to illustrate brute force

import java.util.*;

public class dj {

	public static int n;
	public static int[] nums;
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Process all cases.
		for (int loop=1; loop<=nC; loop++) {
		
			// Read in numbers.
			n = stdin.nextInt();
			nums = new int[n];
			for (int i=0; i<n; i++)
				nums[i] = stdin.nextInt();
		
			// Ta da!
			System.out.println("Wave #"+(loop)+": "+go(new int[n], new boolean[n], 0));
		
		}
	}
	
	public static int go(int[] perm, boolean[] used, int k) {
	
		// Done filling in perm, evaluate.
		if (k == n) return eval(perm);
		
		// Answer must be at least than this, so set it as default.
		int res = 0;
		
		// Try each item in slot k.
		for (int i=0; i<n; i++) {
			if (used[i]) continue;
			
			// New item, place it.
			used[i] = true;
			perm[k] = i;
			
			// Get best answer with this prefix.
			int tmp = go(perm, used, k+1);
			
			// Update if this is a better answer.
			if (tmp > res) res = tmp;
			
			// Now, mark this as unused, so that we can try other values in this
			// slot and value i can be used in a future slot.
			used[i] = false; // super important!
		}
		
		return res;
	}
	
	// Returns the desired metric for this permutation.
	public static int eval(int[] perm) {
		int res = 0;
		
		// For each consecutive pair, we add the absolute value of the difference.
		for (int i=0; i<n-1; i++)
			res += Math.abs(nums[perm[i+1]] - nums[perm[i]]);
		return res;
	}
}