description: n towns are arranged in a circle sequentially. The towns are numbered from 1 to n in clockwise order. In the i-th town, there lives a singer with a repertoire of a_i minutes for each i ∈ [1, n].
  
  Each singer visited all n towns in clockwise order, starting with the town he lives in, and gave exactly one concert in each town. In addition, in each town, the i-th singer got inspired and came up with a song that lasts a_i minutes. The song was added to his repertoire so that he could perform it in the rest of the cities.
  
  Hence, for the i-th singer, the concert in the i-th town will last a_i minutes, in the (i + 1)-th town the concert will last 2 ⋅ a_i minutes, ..., in the ((i + k) mod n + 1)-th town the duration of the concert will be (k + 2) ⋅ a_i, ..., in the town ((i + n - 2) mod n + 1) — n ⋅ a_i minutes.
  
  You are given an array of b integer numbers, where b_i is the total duration of concerts in the i-th town. Reconstruct any correct sequence of positive integers a or say that it is impossible.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 10^3) — the number of test cases. Then the test cases follow.
  
  Each test case consists of two lines. The first line contains a single integer n (1 ≤ n ≤ 4 ⋅ 10^4) — the number of cities. The second line contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 10^{9}) — the total duration of concerts in i-th city.
  
  The sum of n over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case, print the answer as follows:
  
  If there is no suitable sequence a, print NO. Otherwise, on the first line print YES, on the next line print the sequence a_1, a_2, ..., a_n of n integers, where a_i (1 ≤ a_i ≤ 10^{9}) is the initial duration of repertoire of the i-th singer. If there are multiple answers, print any of them.
  
  Example
  
  Input
  
  
  4
  3
  12 16 14
  1
  1
  3
  1 2 3
  6
  81 75 75 93 93 87
  
  
  Output
  
  
  YES
  3 1 3 
  YES
  1 
  NO
  YES
  5 5 4 1 4 5 
  
  Note
  
  Let's consider the 1-st test case of the example:
  
    1. the 1-st singer in the 1-st city will give a concert for 3 minutes, in the 2-nd — for 6 minutes, in the 3-rd — for 9 minutes; 
    2. the 2-nd singer in the 1-st city will give a concert for 3 minutes, in the 2-nd — for 1 minute, in the 3-rd - for 2 minutes; 
    3. the 3-rd singer in the 1-st city will give a concert for 6 minutes, in the 2-nd — for 9 minutes, in the 3-rd — for 3 minutes. 
solution: import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintStream;
  import java.io.File;
  import java.io.FileInputStream;
  import java.util.*;
  
  public class Main {
      static FastReader sc = new FastReader();
      
      static void TEST_CASE() {
  		int n = sc.nextInt();
  		long[] arr = new long[n];
  		for(int i = 0 ; i<n ; i++)
  			arr[i] = sc.nextLong();
  		
  		long div = sum(n);
  		long sum = 0;
  		for(long e:arr) sum +=e;
  		if(sum%div!=0) {
  			System.out.println("NO");
  			return;
  		}
  		long tot = sum/div;
  		long ans[] = new long[n];
  		for(int i =0 ; i<n ; i++) {
  			long a1 = arr[i];
  			long a0 = arr[(i-1+n)%n];
  			long x = (a0 - a1 + tot);
  			if(x%n!=0) {
  				System.out.println("NO");
  				return;
  			}
  			ans[i] = x/n;
  			if( x<=0 || ans[i] > 1e9) {
  				System.out.println("NO");
  				return;
  			}
  		}
  		System.out.println("YES");
  		for(long e:ans) {
  			System.out.print(e+" ");
  		}
  		System.out.println();
  	 }
  	 static long sum(long n) {
  		 return (n * (n+1))/2;
  	 }
  
      public static void main(String[] args) {
          // FastReader sc = new FastReader();
          int test = 1;
          test = sc.nextInt();
          while (test-- > 0) {
              TEST_CASE();
          }
      }
  
      static long power(long x, long y, long p) {
          long res = 1;
          x = x % p;
          if (x == 0)
              return 0;
          while (y > 0) {
              if ((y & 1) != 0)
                  res = (res * x) % p;
              y = y >> 1;
              x = (x * x) % p;
          }
          return res;
      }
  
      public static int countSetBits(long number) {
          int count = 0;
          while (number > 0) {
              ++count;
              number &= number - 1;
          }
          return count;
      }
  
      static int lower_bound(long target, long[] a, int pos) {
          if (pos >= a.length)
              return -1;
          int low = pos, high = a.length - 1;
          while (low < high) {
              int mid = low + (high - low) / 2;
              if (a[mid] < target)
                  low = mid + 1;
              else
                  high = mid;
          }
          return a[low] >= target ? low : -1;
      }
  
      private static <T> void swap(int[] a, int i, int j) {
          int tmp = a[i];
          a[i] = a[j];
          a[j] = tmp;
      }
  
      static class pair {
          long a;
          long b;
  
          pair(long x, long y) {
              this.a = x;
              this.b = y;
          }
      }
  
      static class first implements Comparator<pair> {
  
          public int compare(pair p1, pair p2) {
              if (p1.a > p2.a)
                  return -1;
              else if (p1.a < p2.a)
                  return 1;
              return 0;
          }
      }
  
      static class second implements Comparator<pair> {
  
          public int compare(pair p1, pair p2) {
              if (p1.b > p2.b)
                  return 1;
              else if (p1.b < p2.b)
                  return -1;
              return 0;
          }
      }
  
      private static long getSum(int[] array) {
          long sum = 0;
          for (int value : array) {
              sum += value;
          }
          return sum;
      }
  
      private static boolean isPrime(Long x) {
          if (x < 2)
              return false;
          for (long d = 2; d * d <= x; ++d) {
              if (x % d == 0)
                  return false;
          }
          return true;
      }
  
      static long[] reverse(long a[]) {
          int n = a.length;
          int i, k;
          long t;
          for (i = 0; i < n / 2; i++) {
              t = a[i];
              a[i] = a[n - i - 1];
              a[n - i - 1] = t;
          }
          return a;
      }
  
      private static boolean isPrimeInt(int x) {
          if (x < 2)
              return false;
          for (int d = 2; d * d <= x; ++d) {
              if (x % d == 0)
                  return false;
          }
          return true;
      }
  
      public static String reverse(String input) {
          StringBuilder str = new StringBuilder("");
  
          for (int i = input.length() - 1; i >= 0; i--) {
              str.append(input.charAt(i));
          }
  
          return str.toString();
      }
  
      private static int[] getPrimes(int n) {
          boolean[] used = new boolean[n + 1];
          used[0] = used[1] = true;
          // int size = 0;
          for (int i = 2; i <= n; ++i) {
              if (!used[i]) {
                  // ++size;
                  for (int j = 2 * i; j <= n; j += i) {
                      used[j] = true;
                  }
              }
          }
          int[] primes = new int[n + 1];
          for (int i = 0; i <= n; ++i) {
              if (!used[i]) {
                  primes[i] = 1;
              }
          }
          return primes;
      }
  
      private static long lcm(long a, long b) {
          return a / gcd(a, b) * b;
      }
  
      private static long gcd(long a, long b) {
          return (a == 0 ? b : gcd(b % a, a));
      }
  
      static void sortI(int[] arr) {
          int n = arr.length;
          Random rnd = new Random();
          for (int i = 0; i < n; ++i) {
              int tmp = arr[i];
              int randomPos = i + rnd.nextInt(n - i);
              arr[i] = arr[randomPos];
              arr[randomPos] = tmp;
          }
          Arrays.sort(arr);
      }
  
      static void shuffleList(ArrayList<Long> arr) {
          int n = arr.size();
          Random rnd = new Random();
          for (int i = 0; i < n; ++i) {
              long tmp = arr.get(i);
              int randomPos = i + rnd.nextInt(n - i);
              arr.set(i, arr.get(randomPos));
              arr.set(randomPos, tmp);
          }
      }
  
      static void factorize(long n) {
          int count = 0;
          while (!(n % 2 > 0)) {
              n >>= 1;
  
              count++;
          }
          if (count > 0) {
              // System.out.println("2" + " " + count);
          }
          long i = 0;
          for (i = 3; i <= (long) Math.sqrt(n); i += 2) {
              count = 0;
              while (n % i == 0) {
                  count++;
                  n = n / i;
              }
              if (count > 0) {
                  // System.out.println(i + " " + count);
              }
          }
  
          if (n > 2) {
              // System.out.println(i + " " + count);
          }
      }
  
      static void sortL(long[] arr) {
          int n = arr.length;
          Random rnd = new Random();
          for (int i = 0; i < n; ++i) {
              long tmp = arr[i];
              int randomPos = i + rnd.nextInt(n - i);
              arr[i] = arr[randomPos];
              arr[randomPos] = tmp;
          }
          Arrays.sort(arr);
      }
  
      ////////////////////////////////// DSU START ///////////////////////////
  
      static class DSU {
          int[] parent, rank, total_Elements;
  
          DSU(int n) {
              parent = new int[n + 1];
              rank = new int[n + 1];
              total_Elements = new int[n + 1];
              for (int i = 0; i <= n; i++) {
                  parent[i] = i;
                  rank[i] = 1;
                  total_Elements[i] = 1;
              }
          }
  
          int find(int u) {
              if (parent[u] == u)
                  return u;
              return parent[u] = find(parent[u]);
          }
  
          void unionByRank(int u, int v) {
              int pu = find(u);
              int pv = find(v);
  
              if (pu != pv) {
                  if (rank[pu] > rank[pv]) {
                      parent[pv] = pu;
                      total_Elements[pu] += total_Elements[pv];
                  } else if (rank[pu] < rank[pv]) {
                      parent[pu] = pv;
                      total_Elements[pv] += total_Elements[pu];
                  } else {
                      parent[pu] = pv;
                      total_Elements[pv] += total_Elements[pu];
                      rank[pv]++;
                  }
              }
          }
  
          boolean unionBySize(int u, int v) {
              u = find(u);
              v = find(v);
              if (u != v) {
                  parent[u] = v;
                  total_Elements[v] += total_Elements[u];
                  total_Elements[u] = 0;
                  return true;
              }
              return false;
          }
      }
  
      ////////////////////////////////// DSU END /////////////////////////////
  
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          public boolean hasNext() {
              return false;
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  }