#include <cstdio>
#include <cstring>

int d,n;
int fie[101][101];
int xmax[101];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};

int max(int a,int b){
	if(a>b)return a;
	return b;
}

int main(void){
	scanf("%d",&d);
	for(int data=0;data<d;data++){
		if(data>0)printf("\n");
		scanf("%d",&n);
		memset(fie,0,sizeof(fie));
		memset(xmax,0,sizeof(xmax));
		for(int i=0;i<n;i++){
			fie[0][i]=1;
		}
		int len=0,mlen=n-1,x=0,y=0,dir=1,cnt=0;
		while(mlen>0){
			x+=dx[dir];
			y+=dy[dir];
			xmax[y]=max(xmax[y],x);
			fie[x][y]=1;
			len++;
			if(len==mlen){
				cnt++;
				if(mlen==1)break;
				dir=(dir+1)%4;
				len=0;
			}
			if(cnt==2){
				mlen-=2;
				cnt=0;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				printf("%c",fie[j][i]==1?'#':' ');
			}
			printf("\n");
		}
	}
	return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

I decided to create a program that displays a "round and round pattern". The "round and round pattern" is as follows.

* If the length of one side is n, it is displayed as a character string with n rows and n columns.
* A spiral pattern that rotates clockwise with the lower left corner as the base point.
* The part with a line is represented by # (half-width sharp), and the blank part is represented by "" (half-width blank).
* Leave a space between the lines.



Create a program that takes an integer n as an input and outputs a "round and round pattern" with a side length of n.



Input

The input is given in the following format:


d
n1
n2
::
nd


The number of datasets d (d ≤ 20) is given to the first line, and the side length ni (1 ≤ ni ≤ 100) of the i-th round pattern is given to each of the following d lines.

Output

Please output a round and round pattern for each data set. Insert a blank line between the datasets.

Example

Input

2
5
6


Output

#####
#   #
# # #
# # #
# ###

######
#    #
# ## #
# #  #
# #  #
# ####

### Response

```cpp
#include <cstdio>
#include <cstring>

int d,n;
int fie[101][101];
int xmax[101];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};

int max(int a,int b){
	if(a>b)return a;
	return b;
}

int main(void){
	scanf("%d",&d);
	for(int data=0;data<d;data++){
		if(data>0)printf("\n");
		scanf("%d",&n);
		memset(fie,0,sizeof(fie));
		memset(xmax,0,sizeof(xmax));
		for(int i=0;i<n;i++){
			fie[0][i]=1;
		}
		int len=0,mlen=n-1,x=0,y=0,dir=1,cnt=0;
		while(mlen>0){
			x+=dx[dir];
			y+=dy[dir];
			xmax[y]=max(xmax[y],x);
			fie[x][y]=1;
			len++;
			if(len==mlen){
				cnt++;
				if(mlen==1)break;
				dir=(dir+1)%4;
				len=0;
			}
			if(cnt==2){
				mlen-=2;
				cnt=0;
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				printf("%c",fie[j][i]==1?'#':' ');
			}
			printf("\n");
		}
	}
	return 0;
}
```