#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef vector<string> vs;

int n;

bool check(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < n;
}

int main() {
	int N;
	cin >> N;
	while (N--) {
		cin >> n;
		vs str(n);
		REP(i, n) str[i].resize(n, ' ');
		
		int dx[4] = { 0, 1, 0, -1 };
		int dy[4] = { -1, 0, 1, 0 };
		int nx = 0, ny = n - 1, d = 0, cnt = 0;
		
		while (true) {
			if (cnt == n) break;
			str[ny][nx] = '#';
			
			if (!check(nx + dx[d], ny + dy[d]) ||
				(check(nx + dx[d]*2, ny + dy[d]*2) && str[ny + dy[d]*2][nx + dx[d]*2] == '#') ) {
				d = (d + 1) % 4;
				cnt++;
			}
			else {
				nx += dx[d]; ny += dy[d];
			}
		}
		
		REP(i, n) cout << str[i] << endl;
		if (N != 0) putchar('\n');
	}
	return 0;
}
### Prompt

Generate 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 <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef vector<string> vs;

int n;

bool check(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < n;
}

int main() {
	int N;
	cin >> N;
	while (N--) {
		cin >> n;
		vs str(n);
		REP(i, n) str[i].resize(n, ' ');
		
		int dx[4] = { 0, 1, 0, -1 };
		int dy[4] = { -1, 0, 1, 0 };
		int nx = 0, ny = n - 1, d = 0, cnt = 0;
		
		while (true) {
			if (cnt == n) break;
			str[ny][nx] = '#';
			
			if (!check(nx + dx[d], ny + dy[d]) ||
				(check(nx + dx[d]*2, ny + dy[d]*2) && str[ny + dy[d]*2][nx + dx[d]*2] == '#') ) {
				d = (d + 1) % 4;
				cnt++;
			}
			else {
				nx += dx[d]; ny += dy[d];
			}
		}
		
		REP(i, n) cout << str[i] << endl;
		if (N != 0) putchar('\n');
	}
	return 0;
}
```