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

bool isOver(int x, int y, int n)
{
	if (x<0||n<=x||y<0||n<=y) return true;
	return false;
}

int main()
{
	int d, i, n, j, k;
	int x, y, dir;
	int turn;
	char s[101][101];
	int dx[4] = {0, 1, 0, -1};
	int dy[4] = {-1, 0, 1, 0};
	int chkx[4] = {1, 1, -1, -1};
	int chky[4] = {-1, 1, 1, -1};
	cin>>d;
	for (i = 0; i < d; i++) {
		cin>>n;
		for (j = 0; j < n; j++)
			for (k = 0; k < n; k++)
				s[k][j] = ' ';
		x = 0; y = n-1; dir = 0;
		turn = 0;
		while (turn<4) {
			s[x][y] = '#';
			if ( isOver(x+dx[dir], y+dy[dir], n) ) {
				dir = (dir+1)%4;
				turn++;
				continue;
			}
			if ( !isOver(x+2*dx[dir], y+2*dy[dir], n) ) {
				if (s[x+2*dx[dir]][y+2*dy[dir]] == '#') {
					dir = (dir+1)%4;
					turn++;
					continue;
				}
			}
			if ( !isOver(x+chkx[dir], y+chky[dir], n) )
				if (s[x+chkx[dir]][y+chky[dir]] == '#') break;
			x += dx[dir];
			y += dy[dir];
			turn = 0;
		}
		if (i) cout<<endl;
		for (j = 0; j < n; j++) {
			for (k = 0; k < n; k++) {
				cout<<s[k][j];
			}
			cout<<endl;
		}
	}
	return 0;
}
### Prompt

Please formulate 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<string>
using namespace std;

bool isOver(int x, int y, int n)
{
	if (x<0||n<=x||y<0||n<=y) return true;
	return false;
}

int main()
{
	int d, i, n, j, k;
	int x, y, dir;
	int turn;
	char s[101][101];
	int dx[4] = {0, 1, 0, -1};
	int dy[4] = {-1, 0, 1, 0};
	int chkx[4] = {1, 1, -1, -1};
	int chky[4] = {-1, 1, 1, -1};
	cin>>d;
	for (i = 0; i < d; i++) {
		cin>>n;
		for (j = 0; j < n; j++)
			for (k = 0; k < n; k++)
				s[k][j] = ' ';
		x = 0; y = n-1; dir = 0;
		turn = 0;
		while (turn<4) {
			s[x][y] = '#';
			if ( isOver(x+dx[dir], y+dy[dir], n) ) {
				dir = (dir+1)%4;
				turn++;
				continue;
			}
			if ( !isOver(x+2*dx[dir], y+2*dy[dir], n) ) {
				if (s[x+2*dx[dir]][y+2*dy[dir]] == '#') {
					dir = (dir+1)%4;
					turn++;
					continue;
				}
			}
			if ( !isOver(x+chkx[dir], y+chky[dir], n) )
				if (s[x+chkx[dir]][y+chky[dir]] == '#') break;
			x += dx[dir];
			y += dy[dir];
			turn = 0;
		}
		if (i) cout<<endl;
		for (j = 0; j < n; j++) {
			for (k = 0; k < n; k++) {
				cout<<s[k][j];
			}
			cout<<endl;
		}
	}
	return 0;
}
```