#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,dy[]={-1,0,1,0},dx[]={0,1,0,-1};
char c[100][100];

int main(){
	cin>>n;
	int f=0;
	while(cin>>n){
		if(f)cout<<endl;
		if(n==1){cout<<"#"<<endl;f=1;continue;}
		for(int i=0;i<n*n;i++)c[i/n][i%n]=' ';
		int y=n-1,x=0,u=0,d=n-1,l=0,r=n-1;
		c[y][x]='#';
		for(int i=0;i<n;i++){
			while(1){
				y+=dy[i%4];x+=dx[i%4];
				c[y][x]='#';
				if(i%4==0&&y==u||i%4==1&&x==r||i%4==2&&y==d||i%4==3&&x==l)break;
			}
			if(i%4==0)l+=2;
			if(i%4==1)u+=2;
			if(i%4==2)r-=2;
			if(i%4==3)d-=2;
		}
		for(int i=0;i<n*n;i++){
			cout<<c[i/n][i%n];
			if(i%n==n-1)cout<<endl;
		}
		f=1;
	}
}
### Prompt

Your challenge is to write a Cpp solution 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
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,dy[]={-1,0,1,0},dx[]={0,1,0,-1};
char c[100][100];

int main(){
	cin>>n;
	int f=0;
	while(cin>>n){
		if(f)cout<<endl;
		if(n==1){cout<<"#"<<endl;f=1;continue;}
		for(int i=0;i<n*n;i++)c[i/n][i%n]=' ';
		int y=n-1,x=0,u=0,d=n-1,l=0,r=n-1;
		c[y][x]='#';
		for(int i=0;i<n;i++){
			while(1){
				y+=dy[i%4];x+=dx[i%4];
				c[y][x]='#';
				if(i%4==0&&y==u||i%4==1&&x==r||i%4==2&&y==d||i%4==3&&x==l)break;
			}
			if(i%4==0)l+=2;
			if(i%4==1)u+=2;
			if(i%4==2)r-=2;
			if(i%4==3)d-=2;
		}
		for(int i=0;i<n*n;i++){
			cout<<c[i/n][i%n];
			if(i%n==n-1)cout<<endl;
		}
		f=1;
	}
}
```