#include<iostream>
#include<cstring>
using namespace std;


char a[102][102];
int dx[]={ 0,1,0,-1};
int dy[]={-1,0,1,0};

int main(){
	bool fst=true;
	int n;
	cin>>n;
	while(n--){
		memset(a,' ',sizeof(a));
		int m,y,x,dir;
		cin>>m;
		if(m==1){
			if(!fst)cout<<endl;		
			cout<<"#\n";
			fst=false;
			continue;
		}
		y=m;x=1;dir=0;
		a[y][x]='#';
		while(1){
			for(int i=0;i<m-1;i++){
				if(a[y+2*dy[dir]][x+2*dx[dir]]=='#')break;
				y+=dy[dir];
				x+=dx[dir];
				a[y][x]='#';
			}
			dir=(dir+1)%4;
			if(a[y+2*dy[dir]][x+2*dx[dir]]=='#')break;
			if(a[y-1][x-1]=='#'||a[y-1][x+1]=='#'||a[y+1][x-1]=='#'||a[y+1][x+1]=='#')break;
		}
		if(!fst)cout<<endl;
		fst=false;	
		for(int i=1;i<=m;i++){
			for(int j=1;j<=m;j++)cout<<a[i][j];
			cout<<endl;
		}
	}
	return 0;
}
### Prompt

Your task is to create a Cpp solution to the following problem:

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<iostream>
#include<cstring>
using namespace std;


char a[102][102];
int dx[]={ 0,1,0,-1};
int dy[]={-1,0,1,0};

int main(){
	bool fst=true;
	int n;
	cin>>n;
	while(n--){
		memset(a,' ',sizeof(a));
		int m,y,x,dir;
		cin>>m;
		if(m==1){
			if(!fst)cout<<endl;		
			cout<<"#\n";
			fst=false;
			continue;
		}
		y=m;x=1;dir=0;
		a[y][x]='#';
		while(1){
			for(int i=0;i<m-1;i++){
				if(a[y+2*dy[dir]][x+2*dx[dir]]=='#')break;
				y+=dy[dir];
				x+=dx[dir];
				a[y][x]='#';
			}
			dir=(dir+1)%4;
			if(a[y+2*dy[dir]][x+2*dx[dir]]=='#')break;
			if(a[y-1][x-1]=='#'||a[y-1][x+1]=='#'||a[y+1][x-1]=='#'||a[y+1][x+1]=='#')break;
		}
		if(!fst)cout<<endl;
		fst=false;	
		for(int i=1;i<=m;i++){
			for(int j=1;j<=m;j++)cout<<a[i][j];
			cout<<endl;
		}
	}
	return 0;
}
```