#include <iostream>
#include <vector>
#include <string>
using namespace std;

int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
int n;

void debug(vector<string> m){
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			cout << m[y][x];
		}
		cout << endl;
	}
}

void solve(){
	vector<string> m(n);
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			m[y].push_back(' ');
		}
	}
	int x = 0, y = n-1, d=0;
	m[y][x] = '#';
	int cnt=0;
	while( cnt < 4 ){
		int mx, my;
		bool flag = false;
		for(int i=-1 ; i <= 1 ; i++ ){
			mx = x + dx[d%4];
			my = y + dy[d%4];
			mx = mx + dx[(d-i+4)%4];
			my = my + dy[(d-i+4)%4];
			if( mx >= 0 && my >= 0 && mx < n && my < n && m[my][mx] == '#' ){
				flag = true;
			}
		}
		if( flag ){
			d = (d + 1) % 4;
			cnt++;
			continue;
		}
		
		mx = x + dx[d%4];
		my = y + dy[d%4];
		if( mx < 0 || my < 0 || mx >= n || my >= n ){
			d = (d + 1) % 4;
			cnt++;
			continue;
		}
		m[my][mx] = '#';
		x = mx;
		y = my;
		cnt = 0;
	}
	for(int y=0 ; y < n ; y++ ){
		cout << m[y] << endl;
	}
}

int main(){
	int d;
	cin >> d;
	for(int t=0 ; t < d ; t++ ){
		cin >> n;
		solve();
		if( t != d-1 ){
			cout << endl;
		}
	}
}
### Prompt

Your task is to create 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 <vector>
#include <string>
using namespace std;

int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
int n;

void debug(vector<string> m){
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			cout << m[y][x];
		}
		cout << endl;
	}
}

void solve(){
	vector<string> m(n);
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			m[y].push_back(' ');
		}
	}
	int x = 0, y = n-1, d=0;
	m[y][x] = '#';
	int cnt=0;
	while( cnt < 4 ){
		int mx, my;
		bool flag = false;
		for(int i=-1 ; i <= 1 ; i++ ){
			mx = x + dx[d%4];
			my = y + dy[d%4];
			mx = mx + dx[(d-i+4)%4];
			my = my + dy[(d-i+4)%4];
			if( mx >= 0 && my >= 0 && mx < n && my < n && m[my][mx] == '#' ){
				flag = true;
			}
		}
		if( flag ){
			d = (d + 1) % 4;
			cnt++;
			continue;
		}
		
		mx = x + dx[d%4];
		my = y + dy[d%4];
		if( mx < 0 || my < 0 || mx >= n || my >= n ){
			d = (d + 1) % 4;
			cnt++;
			continue;
		}
		m[my][mx] = '#';
		x = mx;
		y = my;
		cnt = 0;
	}
	for(int y=0 ; y < n ; y++ ){
		cout << m[y] << endl;
	}
}

int main(){
	int d;
	cin >> d;
	for(int t=0 ; t < d ; t++ ){
		cin >> n;
		solve();
		if( t != d-1 ){
			cout << endl;
		}
	}
}
```