#include <iostream>
#include <string.h>

using namespace std;
typedef pair<int, int> P;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
bool field[104][104];

void solve()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i)
	{
		memset(field, 1, sizeof(field));
		int num;
		cin >> num;
		for(int j = 0; j < num + 4; ++j)
		{
			field[0][j] = false;
			field[num + 3][j] = false;
		}
		for(int j = 1; j < num + 4; ++j)
		{
			field[j][0] = false;
			field[j][num + 3] = false;
		}
		P pos;
		pos.first = 2;
		pos.second = num + 1;
		int count = num;
		int step = 0;
		field[pos.second][pos.first] = false;
		while(count)
		{
			while(2 <= pos.first && pos.first < (num + 2) && 2 <= pos.second && pos.second < (num + 2))
			{
				if(field[pos.second + 2 * dy[step]][pos.first + 2 * dx[step]] == false)
				{
					break;
				}
				pos.first += dx[step];
				pos.second += dy[step];
				field[pos.second][pos.first] = false;
			}
			step = (step + 1) % 4;
			count--;
		}
		for(int j = 2; j < num + 2; ++j)
		{
			for(int k = 2; k < num + 2; ++k)
			{
				field[j][k] == true ? cout << ' ' : cout << '#';
			}
			cout << endl;
		}
		if(i != n - 1)
		{
			cout << endl;
		}
	}
}

int main()
{
	solve();
	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.h>

using namespace std;
typedef pair<int, int> P;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
bool field[104][104];

void solve()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i)
	{
		memset(field, 1, sizeof(field));
		int num;
		cin >> num;
		for(int j = 0; j < num + 4; ++j)
		{
			field[0][j] = false;
			field[num + 3][j] = false;
		}
		for(int j = 1; j < num + 4; ++j)
		{
			field[j][0] = false;
			field[j][num + 3] = false;
		}
		P pos;
		pos.first = 2;
		pos.second = num + 1;
		int count = num;
		int step = 0;
		field[pos.second][pos.first] = false;
		while(count)
		{
			while(2 <= pos.first && pos.first < (num + 2) && 2 <= pos.second && pos.second < (num + 2))
			{
				if(field[pos.second + 2 * dy[step]][pos.first + 2 * dx[step]] == false)
				{
					break;
				}
				pos.first += dx[step];
				pos.second += dy[step];
				field[pos.second][pos.first] = false;
			}
			step = (step + 1) % 4;
			count--;
		}
		for(int j = 2; j < num + 2; ++j)
		{
			for(int k = 2; k < num + 2; ++k)
			{
				field[j][k] == true ? cout << ' ' : cout << '#';
			}
			cout << endl;
		}
		if(i != n - 1)
		{
			cout << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}
```