#include <iostream>
using namespace std;

char map[104][104];

void next(int x,int y,int r){
	int sum=0;
	int nx[4]={0,1,0,-1};
	int ny[4]={-1,0,1,0};
	for(int i=0;i<4;i++)if(map[x+nx[i]][y+ny[i]]=='#')sum++;
	if(sum<=1){
		map[x][y]='#';
		if(map[x+nx[r]*2][y+ny[r]*2]=='#'){
			r=(r+1)%4;
			next(x+nx[r],y+ny[r],r);
		}
		else{
			next(x+nx[r],y+ny[r],r);
		}
	}
}

void cal(int n){
	for(int i=0;i<104;i++)for(int j=0;j<104;j++)map[i][j]=' ';
	for(int i=0;i<104;i++)map[i][0]=map[0][i]=map[i][n+3]=map[n+3][i]='#';
	next(2,n+1,0);
}

void draw(int n){
	for(int i=2;i<=n+1;i++){
		for(int j=2;j<=n+1;j++){
			cout<<map[j][i];
		}
		cout<<endl;
	}
}
int main(){
	int d,n;
	cin>>d;
	for(int i=1;i<=d;i++){
		cin>>n;
		cal(n);
		draw(n);
		if(i!=d)cout<<endl;
	}
	return 0;
}

### Prompt

Please formulate 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>
using namespace std;

char map[104][104];

void next(int x,int y,int r){
	int sum=0;
	int nx[4]={0,1,0,-1};
	int ny[4]={-1,0,1,0};
	for(int i=0;i<4;i++)if(map[x+nx[i]][y+ny[i]]=='#')sum++;
	if(sum<=1){
		map[x][y]='#';
		if(map[x+nx[r]*2][y+ny[r]*2]=='#'){
			r=(r+1)%4;
			next(x+nx[r],y+ny[r],r);
		}
		else{
			next(x+nx[r],y+ny[r],r);
		}
	}
}

void cal(int n){
	for(int i=0;i<104;i++)for(int j=0;j<104;j++)map[i][j]=' ';
	for(int i=0;i<104;i++)map[i][0]=map[0][i]=map[i][n+3]=map[n+3][i]='#';
	next(2,n+1,0);
}

void draw(int n){
	for(int i=2;i<=n+1;i++){
		for(int j=2;j<=n+1;j++){
			cout<<map[j][i];
		}
		cout<<endl;
	}
}
int main(){
	int d,n;
	cin>>d;
	for(int i=1;i<=d;i++){
		cin>>n;
		cal(n);
		draw(n);
		if(i!=d)cout<<endl;
	}
	return 0;
}

```