#include <iostream>
using namespace std;
int t,u,r,l;

char mark[100][100];
bool flag = 0;
int n;
/*
0:ツ湘」
1:ツ右
2:ツ可コ
3:ツ債カ
*/
void saiki(int x,int y,int turn){
	if(flag){
		if(n%2==0)mark[x][y]='#';
		return;
	}
	mark[x][y]='#';
	if( turn == 0 && y==t ){
		l+=2;
		if(x+1>=r){flag=1;}
		saiki(x+1,y,(turn+1)%4);
	}else if(turn == 2 && y==u ){
		r-=2;
		if(x-1<=l){flag=1;}
		saiki(x-1,y,(turn+1)%4);
	}else if(turn == 3 && x == l){
		u-=2;
		if(y-1<=t){flag=1;}
		saiki(x,y-1,(turn+1)%4);
	}else if(turn == 1 && x == r){
		t+=2;
		if(y+1>=u){flag=1;}
		saiki(x,y+1,(turn+1)%4);
	}else {
		if(turn == 0)saiki(x,y-1,turn);
		else if(turn == 1)saiki(x+1,y,turn);
		else if(turn == 2)saiki(x,y+1,turn);
		else if(turn == 3)saiki(x-1,y,turn);
	}
}

int main(){
	int c = 0;
	cin >> n;
	while(cin >> n){
		if(c++)cout << endl;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)
				mark[j][i]=' ';
		}
		flag = 0;
		l = t = 0;
		r = u = n-1;
		saiki(0,n-1,0);
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)
				cout << mark[j][i];
			cout << endl;
		}
	}
}
### Prompt

In cpp, your task is to solve 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;
int t,u,r,l;

char mark[100][100];
bool flag = 0;
int n;
/*
0:ツ湘」
1:ツ右
2:ツ可コ
3:ツ債カ
*/
void saiki(int x,int y,int turn){
	if(flag){
		if(n%2==0)mark[x][y]='#';
		return;
	}
	mark[x][y]='#';
	if( turn == 0 && y==t ){
		l+=2;
		if(x+1>=r){flag=1;}
		saiki(x+1,y,(turn+1)%4);
	}else if(turn == 2 && y==u ){
		r-=2;
		if(x-1<=l){flag=1;}
		saiki(x-1,y,(turn+1)%4);
	}else if(turn == 3 && x == l){
		u-=2;
		if(y-1<=t){flag=1;}
		saiki(x,y-1,(turn+1)%4);
	}else if(turn == 1 && x == r){
		t+=2;
		if(y+1>=u){flag=1;}
		saiki(x,y+1,(turn+1)%4);
	}else {
		if(turn == 0)saiki(x,y-1,turn);
		else if(turn == 1)saiki(x+1,y,turn);
		else if(turn == 2)saiki(x,y+1,turn);
		else if(turn == 3)saiki(x-1,y,turn);
	}
}

int main(){
	int c = 0;
	cin >> n;
	while(cin >> n){
		if(c++)cout << endl;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)
				mark[j][i]=' ';
		}
		flag = 0;
		l = t = 0;
		r = u = n-1;
		saiki(0,n-1,0);
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)
				cout << mark[j][i];
			cout << endl;
		}
	}
}
```