#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

const int dy[4] = {-1,0,1,0}, dx[4] = {0,1,0,-1};
int N;
bool fld[100][100];

bool end(int y,int x){
	int cnt = 0;
	for(int i=0;i<4;i++){
		int ny,nx;
		ny = y+dy[i]; nx = x+dx[i];
		if(ny<0 || N<=ny || nx<0 || N<=nx) continue;
		if(fld[ny][nx]) cnt++;
	}
	if(cnt>=2) return true;
	return false;
}

void dfs(int n,int dir,int y,int x){
	if(n<2) return;
	int cnt = 2;
	if(n==N) cnt = 3;
	for(int i=0;i<cnt;i++){
		for(int j=0;j<n-1;j++){
			y += dy[dir]; x += dx[dir];
			if(end(y,x)) return;
			fld[y][x] = true;
		}
		dir = (dir+1)%4;
	}
	dfs(n-2,dir,y,x);
}

int main(){
	int ds;
	cin>>ds;
	for(int k=0;k<ds;k++){
		if(k!=0) puts("");
		cin>>N;
		fill_n((bool*)fld,100*100,false);
		fld[N-1][0] = true; dfs(N,0,N-1,0);
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(fld[i][j]) printf("#");
				else printf(" ");
			}puts("");
		}
	}
	return 0;
}
### Prompt

Please create a solution in CPP 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
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

const int dy[4] = {-1,0,1,0}, dx[4] = {0,1,0,-1};
int N;
bool fld[100][100];

bool end(int y,int x){
	int cnt = 0;
	for(int i=0;i<4;i++){
		int ny,nx;
		ny = y+dy[i]; nx = x+dx[i];
		if(ny<0 || N<=ny || nx<0 || N<=nx) continue;
		if(fld[ny][nx]) cnt++;
	}
	if(cnt>=2) return true;
	return false;
}

void dfs(int n,int dir,int y,int x){
	if(n<2) return;
	int cnt = 2;
	if(n==N) cnt = 3;
	for(int i=0;i<cnt;i++){
		for(int j=0;j<n-1;j++){
			y += dy[dir]; x += dx[dir];
			if(end(y,x)) return;
			fld[y][x] = true;
		}
		dir = (dir+1)%4;
	}
	dfs(n-2,dir,y,x);
}

int main(){
	int ds;
	cin>>ds;
	for(int k=0;k<ds;k++){
		if(k!=0) puts("");
		cin>>N;
		fill_n((bool*)fld,100*100,false);
		fld[N-1][0] = true; dfs(N,0,N-1,0);
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(fld[i][j]) printf("#");
				else printf(" ");
			}puts("");
		}
	}
	return 0;
}
```