#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define it vector<int>::iterator
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;
int main(){
	int m;
	cin>>m;
	while(m--){
		int n;
		cin>>n;
		vector<vector<char> >in(n+4,vector<char>(n+4,' '));
		rep(i,n+4)rep(j,n+4)
		if(!i||!j||i==n+3||j==n+3)in[i][j]='#';
		int x=n+2,y=2;
		int dx[]={-1,0,1,0};
		int dy[]={0,1,0,-1};
		int co=-1;
		rep(k,n){
			co++;
			if(co==4)co=0;
			while(1){
				int xx=x+dx[co];
				int yy=y+dy[co];
				bool q=true;
				rep(i,4){if(co!=(i+2)%4&&in[xx+dx[i]][yy+dy[i]]=='#')q=false;}
				if(!q)break;
				x=xx;y=yy;
				in[x][y]='#';
			}
		}
		rep(i,n){rep(j,n)cout<<in[i+2][j+2];cout<<endl;}
		if(m)cout<<endl;
	}
}
### Prompt

Create a solution in Cpp for 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<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define it vector<int>::iterator
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;
int main(){
	int m;
	cin>>m;
	while(m--){
		int n;
		cin>>n;
		vector<vector<char> >in(n+4,vector<char>(n+4,' '));
		rep(i,n+4)rep(j,n+4)
		if(!i||!j||i==n+3||j==n+3)in[i][j]='#';
		int x=n+2,y=2;
		int dx[]={-1,0,1,0};
		int dy[]={0,1,0,-1};
		int co=-1;
		rep(k,n){
			co++;
			if(co==4)co=0;
			while(1){
				int xx=x+dx[co];
				int yy=y+dy[co];
				bool q=true;
				rep(i,4){if(co!=(i+2)%4&&in[xx+dx[i]][yy+dy[i]]=='#')q=false;}
				if(!q)break;
				x=xx;y=yy;
				in[x][y]='#';
			}
		}
		rep(i,n){rep(j,n)cout<<in[i+2][j+2];cout<<endl;}
		if(m)cout<<endl;
	}
}
```