#include<iostream>
using namespace std;

#define MAX_N 300

int x[MAX_N][MAX_N];
int n, a, cx, cy, cnt;

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

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		if (i >= 1) { cout << endl; }
		cnt = 0;
		cin >> a;
		for (int j = 0; j < MAX_N; j++) {
			for (int k = 0; k < MAX_N; k++) {
				x[j][k] = 0;
			}
		}
		cx = 0; cy = a - 1;
		x[cy][cx] = 1;
		while (cnt < a) {
			while (true) {
				int Y1 = cy + dy[cnt % 4];
				int X1 = cx + dx[cnt % 4];
				int Y2 = cy + dy[cnt % 4] * 2;
				int X2 = cx + dx[cnt % 4] * 2;
				if (Y1 >= 0 && Y1 < a && X1 >= 0 && X1 < a) {
					if (Y2 >= 0 && Y2 < a && X2 >= 0 && X2 < a) {
						if (x[Y2][X2] == 1) {
							break;
						}
					}
				}
				else {
					break;
				}
				cx = X1; cy = Y1;
				x[cy][cx] = 1;
			}
			cnt++;
		}
		for (int j = 0; j < a; j++) {
			for (int k = 0; k < a; k++) {
				if (x[j][k] == 1) {
					cout << '#';
				}
				else {
					cout << ' ';
				}
			}
			cout << endl;
		}
	}
}
### 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>
using namespace std;

#define MAX_N 300

int x[MAX_N][MAX_N];
int n, a, cx, cy, cnt;

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

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		if (i >= 1) { cout << endl; }
		cnt = 0;
		cin >> a;
		for (int j = 0; j < MAX_N; j++) {
			for (int k = 0; k < MAX_N; k++) {
				x[j][k] = 0;
			}
		}
		cx = 0; cy = a - 1;
		x[cy][cx] = 1;
		while (cnt < a) {
			while (true) {
				int Y1 = cy + dy[cnt % 4];
				int X1 = cx + dx[cnt % 4];
				int Y2 = cy + dy[cnt % 4] * 2;
				int X2 = cx + dx[cnt % 4] * 2;
				if (Y1 >= 0 && Y1 < a && X1 >= 0 && X1 < a) {
					if (Y2 >= 0 && Y2 < a && X2 >= 0 && X2 < a) {
						if (x[Y2][X2] == 1) {
							break;
						}
					}
				}
				else {
					break;
				}
				cx = X1; cy = Y1;
				x[cy][cx] = 1;
			}
			cnt++;
		}
		for (int j = 0; j < a; j++) {
			for (int k = 0; k < a; k++) {
				if (x[j][k] == 1) {
					cout << '#';
				}
				else {
					cout << ' ';
				}
			}
			cout << endl;
		}
	}
}
```