#include <iostream>
using namespace std;

int main(void){
	int i,j,m,n,d,walk;
	int di[]={-1,0,1,0};
	int dj[]={0,1,0,-1};
	char rst[104][104];

	cin>>m;
	while(m--){
		cin>>n;

		for(i=0;i<n+4;i++){
			for(j=0;j<n+4;j++){
				if(i==0 || i==n+3 || j==0 || j==n+3) rst[i][j] = '#';
				else rst[i][j] = ' ';
			}
		}

		i = n + 1;
		j = 2;
		d = 0;

		while(1){
			for(walk=0;rst[i+2*di[d]][j+2*dj[d]] != '#';walk++){
				rst[i][j] = '#';
				i += di[d];
				j += dj[d];
			}

			rst[i][j] = '#';
			d = (d+1) % 4;
			if(walk <= 1) break;
		}

		if(n==2) rst[2][3]='#';
		for(i=2;i<n+2;i++){
			for(j=2;j<n+2;j++) cout<<rst[i][j];
			cout<<endl;
		}
		if(m) cout<<endl;
	}

	return 0;
}
### Prompt

Please provide a cpp coded solution to the problem described below:

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;

int main(void){
	int i,j,m,n,d,walk;
	int di[]={-1,0,1,0};
	int dj[]={0,1,0,-1};
	char rst[104][104];

	cin>>m;
	while(m--){
		cin>>n;

		for(i=0;i<n+4;i++){
			for(j=0;j<n+4;j++){
				if(i==0 || i==n+3 || j==0 || j==n+3) rst[i][j] = '#';
				else rst[i][j] = ' ';
			}
		}

		i = n + 1;
		j = 2;
		d = 0;

		while(1){
			for(walk=0;rst[i+2*di[d]][j+2*dj[d]] != '#';walk++){
				rst[i][j] = '#';
				i += di[d];
				j += dj[d];
			}

			rst[i][j] = '#';
			d = (d+1) % 4;
			if(walk <= 1) break;
		}

		if(n==2) rst[2][3]='#';
		for(i=2;i<n+2;i++){
			for(j=2;j<n+2;j++) cout<<rst[i][j];
			cout<<endl;
		}
		if(m) cout<<endl;
	}

	return 0;
}
```