#include<stdio.h>
#define N 30
int visit[N];
struct node {
int prenum,index,count,pre;
}a[N];
int b[N];
int main() {
int t,m,n,i,j,k,sum;
scanf("%d",&t);
while(t--) {
scanf("%d",&n);
for(i=1;i<=n;i++) {
a[i].count=a[i].prenum=0;
scanf("%d",&a[i].pre);
a[i].index=i;
if(i==1)
a[i].prenum=a[i].pre;
else
a[i].prenum=a[i].pre-a[i-1].pre;
a[i].count=a[i].prenum;
}
for(i=1;i<=n;i++) {
j=i;
sum=0;
while(a[j].count==0) {
sum+=a[j].prenum;
j--;
}
a[j].count--;
b[i]=sum+a[j].prenum-a[j].count;
}
for(i=1;i<n;i++)
printf("%d ",b[i]);
printf("%d\n",b[n]);
}
return 0;
}