#include <iostream>
#include <cstring>
using namespace std;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

void solve(int n) {
	if (n == 1) {
		cout << '#' << endl;
		return;
	}
	char field[n][n + 1];
	memset(field, ' ', sizeof(field));
	for (int i = 0; i < n; i++) {
		field[i][n] = '\0';
	}
	int x = 0, y = n - 1, d = 0;
	while (true) {
		field[y][x] = '#';
		int newX = x + dx[d];
		int newY = y + dy[d];
		if (newX < 0 || n <= newX || newY < 0 || n <= newY
				|| field[newY+ dy[d]][newX+ dx[d]] == '#') {
			d = (d + 1) % 4;
			newX = x + dx[d];
			newY = y + dy[d];
		}
		int count = 0;
		for (int i = 0; i < 4; i++) {
			int cx = newX + dx[i];
			int cy = newY + dy[i];
			if (0 <= cx && cx < n && 0 <= cy && cy < n && field[cy][cx] == '#') count++;
		}
		if (count > 1) break;
		x = newX;
		y = newY;
	}
	for (int i = 0; i < n; i++) {
		cout << field[i] << endl;
	}
}

int main () {
	int d;
	cin >> d;
	for (int i = 0; i < d; i++) {
		int n;
		cin >> n;
		if (i != 0) cout << endl;
		solve(n);
	}
	return 0;
}
### 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 <cstring>
using namespace std;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

void solve(int n) {
	if (n == 1) {
		cout << '#' << endl;
		return;
	}
	char field[n][n + 1];
	memset(field, ' ', sizeof(field));
	for (int i = 0; i < n; i++) {
		field[i][n] = '\0';
	}
	int x = 0, y = n - 1, d = 0;
	while (true) {
		field[y][x] = '#';
		int newX = x + dx[d];
		int newY = y + dy[d];
		if (newX < 0 || n <= newX || newY < 0 || n <= newY
				|| field[newY+ dy[d]][newX+ dx[d]] == '#') {
			d = (d + 1) % 4;
			newX = x + dx[d];
			newY = y + dy[d];
		}
		int count = 0;
		for (int i = 0; i < 4; i++) {
			int cx = newX + dx[i];
			int cy = newY + dy[i];
			if (0 <= cx && cx < n && 0 <= cy && cy < n && field[cy][cx] == '#') count++;
		}
		if (count > 1) break;
		x = newX;
		y = newY;
	}
	for (int i = 0; i < n; i++) {
		cout << field[i] << endl;
	}
}

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