description: Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number 0, he threw away all numbers equal to 0 from the array. As a result, he got an array a of length n.
  
  Pupsen, on the contrary, likes the number 0 and he got upset when he saw the array without zeroes. To cheer Pupsen up, Vupsen decided to come up with another array b of length n such that ∑_{i=1}^{n}a_i ⋅ b_i=0. Since Vupsen doesn't like number 0, the array b must not contain numbers equal to 0. Also, the numbers in that array must not be huge, so the sum of their absolute values cannot exceed 10^9. Please help Vupsen to find any such array b!
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases. The next 2 ⋅ t lines contain the description of test cases. The description of each test case consists of two lines.
  
  The first line of each test case contains a single integer n (2 ≤ n ≤ 10^5) — the length of the array.
  
  The second line contains n integers a_1, a_2, …, a_n (-10^4 ≤ a_i ≤ 10^4, a_i ≠ 0) — the elements of the array a.
  
  It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case print n integers b_1, b_2, …, b_n — elements of the array b (|b_1|+|b_2|+… +|b_n| ≤ 10^9, b_i ≠ 0, ∑_{i=1}^{n}a_i ⋅ b_i=0).
  
  It can be shown that the answer always exists.
  
  Example
  
  Input
  
  
  3
  2
  5 5
  5
  5 -2 10 -9 4
  7
  1 2 3 4 5 6 7
  
  
  Output
  
  
  1 -1
  -1 5 1 -1 -1
  -10 2 2 -3 5 -1 -1
  
  Note
  
  In the first test case, 5 ⋅ 1 + 5 ⋅ (-1)=5-5=0. You could also print 3 -3, for example, since 5 ⋅ 3 + 5 ⋅ (-3)=15-15=0
  
  In the second test case, 5 ⋅ (-1) + (-2) ⋅ 5 + 10 ⋅ 1 + (-9) ⋅ (-1) + 4 ⋅ (-1)=-5-10+10+9-4=0.
solution: import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStreamWriter;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.PriorityQueue;
  import java.util.Map.Entry;
  
  
  import java.util.Random;
  import java.util.TreeSet;
  
  public final class CF_750_D2_D
  {
  
  
  	static boolean verb=true;
  	static void log(Object X){if (verb) System.err.println(X);}
  	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
  	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
  	static void logWln(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");}}
  	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
  	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}
  
  	static void logWln(Object X){if (verb) System.err.print(X);}
  	static void info(Object o){	System.out.println(o);}
  	static void output(Object o){outputWln(""+o+"\n");	}
  	static void outputFlush(Object o){try {out.write(""+ o+"\n");out.flush();} catch (Exception e) {}}
  	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}
  
  
  	static void logBin(int[] tm) {for (int x:tm) logWln(bin(8,x)+" ");log("");}
  
  	static String bin(int L,int x) {
  		String s=Integer.toBinaryString(x);
  		while (s.length()<L) s="0"+s;
  		return s;
  	}
  
  	// Global vars
  	static BufferedWriter out;
  	static InputReader reader;
  
  
  	static void test() {
  		log("testing");
  
  		Random r=new Random();
  		int NTESTS=10000000;
  		int NMAX=10;
  		int VMAX=1;
  		for (int t=0;t<NTESTS;t++) {
  			int n=r.nextInt(NMAX)+2;
  			int[] a=new int[n];
  			for (int i=0;i<n;i++) {
  				a[i]=r.nextInt(2*VMAX)-VMAX;
  				if (a[i]==0)
  					a[i]=1;
  			}
  			int[] b=solve(a);
  			long m=product(a,b);
  			long sum=0;
  			for (int x:b)
  				sum+=Math.abs(x);
  			boolean zero=false;
  			for (int x:b) {
  				if (x==0)
  					zero=true;
  			}
  			if (!check(a,b)) {
  				log("Error");
  				return;
  			}
  
  		}
  		log("testing done");
  
  	}
  
  
  	static boolean check(int[] a,int[] b) {
  		long m=product(a,b);
  		long sum=0;
  		for (int x:b)
  			sum+=Math.abs(x);
  		boolean zero=false;
  		for (int x:b) {
  			if (x==0)
  				zero=true;
  		}
  		if (sum>=1000000000 ||m!=0||zero) {
  			log("Error");
  			log("product:"+m);
  			log("sum:"+sum);
  			log("zero:"+zero);
  			log(a);
  			log(b);
  			return false;
  		}
  
  		return true;
  	}
  
  
  	static int MX=Integer.MAX_VALUE;
  
  	static long product(int[] a,int[] b) {
  		long p=0;
  		int n=a.length;
  		for (int i=0;i<n;i++) {
  			p+=(long)a[i]*(long)b[i];
  		}
  		return p;
  	}
  
  
  	static int pgcd(int a,int b){
  		if (a<b)
  			return pgcd(b,a);
  		while (b!=0){
  			int c=b;
  			b=a%b;
  			a=c;
  		}
  		return a;
  	}
  
  	// this does not prevent some zero
  
  
  	static int[][] perm= {{0,1,2},{0,2,1},{1,2,0}};
  
  	static int[] solve(int[] a) {
  		int n=a.length;
  		int[] b=new int[n];
  
  		if (n%2==0) {
  			
  			for (int i=0;i<n;i+=2) {
  				int p=pgcd(Math.abs(a[i]),Math.abs(a[i+1]));
  				b[i]=a[i+1]/p;
  				b[i+1]=-a[i]/p;
  			}
  		} else {
  
  			long best=Long.MAX_VALUE;
  
  			for (int[] tm:perm) {
  				int e=tm[0];
  				int f=tm[1];
  				int g=tm[2];
  				//logWln("trying");
  				//log(tm);
  				//log("sum:"+(a[e]+a[f]));
  				if ((a[e]+a[f])!=0) {
  				
  					int p=pgcd(Math.abs(a[e]+a[f]),Math.abs(a[g]));
  					long bob=(Math.abs(a[e]+a[f])+Math.abs(2*a[g]*2))/p;
  					if (bob<best) {
  						best=bob;
  						b[g]=-(a[e]+a[f])/p;
  						b[e]=a[g]/p;
  						b[f]=a[g]/p;
  						
  					}
  				}
  			}
  			for (int i=3;i<n;i+=2) {
  				int p=pgcd(Math.abs(a[i]),Math.abs(a[i+1]));
  				b[i]=a[i+1]/p;
  				b[i+1]=-a[i]/p;
  			}
  		}
  		boolean c=check(a,b);
  		if (!c) {
  			log(0/0);
  		}
  		return b;
  
  	}
  
  	static void test2() {
  		log("test2");
  		int n=100000-1;
  		int[] a=new int[n];
  		Arrays.fill(a, 10000);
  		int[] b=solve(a);
  		boolean ok=check(a,b);
  	}
  
  	static void process() throws Exception {
  
  		log("hello");
  		//test2();
  		//test();
  		out = new BufferedWriter(new OutputStreamWriter(System.out));
  		reader = new InputReader(System.in);
  
  		int T=reader.readInt();
  		for (int t=0;t<T;t++) {
  			int n=reader.readInt();
  			int[] a=new int[n];
  			for (int i=0;i<n;i++) {
  				a[i]=reader.readInt();
  			}
  			int[] b=solve(a);
  			for (int x:b) {
  				outputWln(x+" ");
  			}
  			output("");
  
  		}
  
  		try {
  			out.close();
  		} catch (Exception Ex) {
  		}
  
  
  	}
  
  
  
  
  
  	public static void main(String[] args) throws Exception {
  		process();
  
  	}
  
  	static final class InputReader {
  		private final InputStream stream;
  		private final byte[] buf = new byte[1024];
  		private int curChar;
  		private int numChars;
  
  		public InputReader(InputStream stream) {
  			this.stream = stream;
  		}
  
  		private int read() throws IOException {
  			if (curChar >= numChars) {
  				curChar = 0;
  				numChars = stream.read(buf);
  				if (numChars <= 0) {
  					return -1;
  				}
  			}
  			return buf[curChar++];
  		}
  
  		public final String readString() throws IOException {
  			int c = read();
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			StringBuilder res = new StringBuilder();
  			do {
  				res.append((char) c);
  				c = read();
  			} while (!isSpaceChar(c));
  			return res.toString();
  		}
  
  		public final String readString(int L) throws IOException {
  			int c = read();
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			StringBuilder res = new StringBuilder(L);
  			do {
  				res.append((char) c);
  				c = read();
  			} while (!isSpaceChar(c));
  			return res.toString();
  		}
  
  		public final int readInt() throws IOException {
  			int c = read();
  			boolean neg = false;
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			char d = (char) c;
  			// log("d:"+d);
  			if (d == '-') {
  				neg = true;
  				c = read();
  			}
  			int res = 0;
  			do {
  				res *= 10;
  				res += c - '0';
  				c = read();
  			} while (!isSpaceChar(c));
  			// log("res:"+res);
  			if (neg)
  				return -res;
  			return res;
  
  		}
  
  		public final long readLong() throws IOException {
  			int c = read();
  			boolean neg = false;
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			char d = (char) c;
  			// log("d:"+d);
  			if (d == '-') {
  				neg = true;
  				c = read();
  			}
  			long res = 0;
  			do {
  				res *= 10;
  				res += c - '0';
  				c = read();
  			} while (!isSpaceChar(c));
  			// log("res:"+res);
  			if (neg)
  				return -res;
  			return res;
  
  		}
  
  		private boolean isSpaceChar(int c) {
  			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  		}
  	}
  
  }
  