#include "bits/stdc++.h"
using namespace std;

const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };
int main() {
	int D; cin >> D;
	while (D--) {
		int N; cin >> N;
		vector<vector<char>>field(N, vector<char>(N, ' '));
		int way = 3;
		int nx = 0;
		int ny = N - 1;
		bool flag = true;
		while (flag) {
			field[ny][nx] = '#';
			if (N == 1)break;
			for (int i = 0; i < 2; ++i) {
				int nextx = nx + dx[way];
				int nexty = ny + dy[way];
				if (nextx >= 0 && nextx < N&&nexty >= 0 && nexty < N) {
					bool aok = true;
					for (int w = -1; w <= 1; ++w) {
						int nextway = (way + 4 + w) % 4;
						int next2x = nextx + dx[nextway];
						int next2y = nexty + dy[nextway];
						if (next2x >= 0 && next2x < N&&next2y >= 0 && next2y < N) {
							if (field[next2y][next2x] == '#') {
								aok = false;
							}
						}
					}
					if(!aok){
						if(i==1)flag = false;
						
					}
					else {
						nx = nextx;
						ny = nexty;
						break;
					}
				}
				way = (way + 3) % 4;
			}
			
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				cout << field[i][j];
			}
			cout << endl;
		}
		if(D)cout << endl;
	}
	return 0;
}
### Prompt

Please create a solution in CPP 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;

const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };
int main() {
	int D; cin >> D;
	while (D--) {
		int N; cin >> N;
		vector<vector<char>>field(N, vector<char>(N, ' '));
		int way = 3;
		int nx = 0;
		int ny = N - 1;
		bool flag = true;
		while (flag) {
			field[ny][nx] = '#';
			if (N == 1)break;
			for (int i = 0; i < 2; ++i) {
				int nextx = nx + dx[way];
				int nexty = ny + dy[way];
				if (nextx >= 0 && nextx < N&&nexty >= 0 && nexty < N) {
					bool aok = true;
					for (int w = -1; w <= 1; ++w) {
						int nextway = (way + 4 + w) % 4;
						int next2x = nextx + dx[nextway];
						int next2y = nexty + dy[nextway];
						if (next2x >= 0 && next2x < N&&next2y >= 0 && next2y < N) {
							if (field[next2y][next2x] == '#') {
								aok = false;
							}
						}
					}
					if(!aok){
						if(i==1)flag = false;
						
					}
					else {
						nx = nextx;
						ny = nexty;
						break;
					}
				}
				way = (way + 3) % 4;
			}
			
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				cout << field[i][j];
			}
			cout << endl;
		}
		if(D)cout << endl;
	}
	return 0;
}
```