// Arup Guha
// 7/13/2022
// Solution to 2022 SI@UCF Contest #3 Problem: Which Permutation

import java.util.*;

public class whichperm {

	public static int n;
	public static int[] diff;
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Process cases.
		for (int loop=0; loop<nC; loop++) {
		
			// Read permutation differences.
			n = stdin.nextInt();
			diff = new int[n-1];
			for (int i=0; i<n-1; i++)
				diff[i] = stdin.nextInt();
				
			// Set up recursion and go.
			int[] perm = new int[n];
			boolean[] used = new boolean[n];
			boolean res = go(perm, used, 0);
		
			// No solution.
			if (!res)
				System.out.println("impossible");
				
			// Print out the result.
			else {
				for (int i=0; i<n-1; i++)
					System.out.print(perm[i]+" ");
				System.out.println(perm[n-1]);
			}
		}
	}
	
	public static boolean go(int[] perm, boolean[] used, int k) {
	
		// Done!
		if (k == n) return true;
	
		// Here we need to try everything in the first slot.
		if (k == 0) {
			
			// Regular permutation code here...
			for (int i=0; i<n; i++) {
				perm[k] = i;
				used[i] = true;
				boolean tmp = go(perm, used, k+1);
				
				// If we got an answer, stop immediately.
				if (tmp) return true;
				
				used[i] = false;
			}
		
		}
		
		// Previous item, so we bother to only try two items.
		else {
		
			// Set up two possible choices for the next item. Place in order to ensure first lexicographical ordered answer.
			int[] choices = new int[2];
			choices[0] = perm[k-1] - diff[k-1];
			choices[1] = perm[k-1] + diff[k-1];
			
			// Loop through our choices.
			for (int i=0; i<2; i++) {
			
				// Not valid.
				if (choices[i] < 0 || choices[i] >= n || used[choices[i]]) continue;
				
				// Okay, let's go for it!
				perm[k] = choices[i];
				used[choices[i]] = true;
				boolean tmp = go(perm, used, k+1);
				
				// Same here, if we get an answer, stop immediately.
				if (tmp) return true;
				
				used[choices[i]] = false;
			}
		}
		
		// If we get this far, it didn't work.
		return false;
	}
}