# include<stdio.h>
# include<string.h>
# include<algorithm>
using namespace std;
int a[120];
int main(){
int T;
scanf("%d",&T);
while(T--){
int t=1;
for(int i=1;i<=100;i++){
a[i]=t;
t=t+2;
}
int n;
scanf("%d",&n);
int y=n;
int m=1;
while(n!=0){
for(int i=1;i<=a[n];i++){
printf("*");
}
printf("\n");
n=n-1;
if(n==0){
break;
}
for(int i=1;i<=m;i++){
printf(" ");
}
m++;
}
int p=2;
int u=y-2;
while(p<=y){
for(int i=1;i<=u;i++){
printf(" ");
}
u--;
for(int i=1;i<=a[p];i++){
printf("*");
}
printf("\n");
p++;
}
printf("\n");
}
return 0;
}