#include<iostream>
#include<vector>
using namespace std;
int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
int main()
{
	int d;cin>>d;
	while(d--)
	{
		int N;
		cin>>N;
		vector<string>ans(N,string(N,' '));
		int r=0;
		int x=N-1,y=0;
		int id=0,pre=-114514;
		while(true)
		{
			ans[x][y]='#';
			bool flag=false;
			int pr=r;
			for(int i=0;i<4;i++,r=(r+1)%4)
			{
				int tx=x+dx[r]*2,ty=y+dy[r]*2;
				if(tx>=0&&ty>=0&&tx<N&&ty<N)
				{
					if(ans[tx][ty]!='#')break;
				}
				else
				{
					tx-=dx[r];ty-=dy[r];
					if(!(tx<0||ty<0||tx>=N||ty>=N))break;
				}
				if(i==3)
				{
					flag=true;
					break;
				}
			}
			if(flag)break;
			id++;
			if(pr!=r)
			{
				if(id==pre+1)break;
				pre=id;
			}
			x+=dx[r],y+=dy[r];
		}
		for(int i=0;i<N;i++)cout<<ans[i]<<endl;
		if(d)cout<<endl;
	}
}


### 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>
#include<vector>
using namespace std;
int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
int main()
{
	int d;cin>>d;
	while(d--)
	{
		int N;
		cin>>N;
		vector<string>ans(N,string(N,' '));
		int r=0;
		int x=N-1,y=0;
		int id=0,pre=-114514;
		while(true)
		{
			ans[x][y]='#';
			bool flag=false;
			int pr=r;
			for(int i=0;i<4;i++,r=(r+1)%4)
			{
				int tx=x+dx[r]*2,ty=y+dy[r]*2;
				if(tx>=0&&ty>=0&&tx<N&&ty<N)
				{
					if(ans[tx][ty]!='#')break;
				}
				else
				{
					tx-=dx[r];ty-=dy[r];
					if(!(tx<0||ty<0||tx>=N||ty>=N))break;
				}
				if(i==3)
				{
					flag=true;
					break;
				}
			}
			if(flag)break;
			id++;
			if(pr!=r)
			{
				if(id==pre+1)break;
				pre=id;
			}
			x+=dx[r],y+=dy[r];
		}
		for(int i=0;i<N;i++)cout<<ans[i]<<endl;
		if(d)cout<<endl;
	}
}


```