#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
bool isOk(int i, int r, int c, bool b[104][104]) {
	if(i%2==0) {
		if(b[r][c-1]==0&&b[r][c+1]==0) {
			if(i==0?b[r-1][c]==0:b[r+1][c]==0) return true;
		}
	} else {
		if(b[r-1][c]==0&&b[r+1][c]==0) {
			if(i==1?b[r][c+1]==0:b[r][c-1]==0) return true;
		}
	}
	return false;
}
int main() {
	int n, a;
	cin >> n;
	bool f = 0;
	rep(i,n) {
		if(f) cout << endl;
		f = 1;
		cin >> a;
		bool b[100+4][100+4] = {};
		rep(i,a+4) {
			b[i][0] = 1;
			b[i][a+3] = 1;
			b[0][i] = 1;
			b[a+3][i] = 1;
		}
		int r = a+1, c = 2, cnt = 0;
		while(1) {
			if(!isOk(cnt, r, c, b)) break;
			while(isOk(cnt, r, c, b)) {
				b[r][c] = 1;
				switch(cnt) {
				case 0: r--;
					break;
				case 1: c++;
					break;
				case 2: r++;
					break;
				case 3: c--;
					break;
				}
			}
			cnt = (cnt+1) % 4;
			switch(cnt) {
				case 0: r--, c++;
					break;
				case 1: c++, r++;
					break;
				case 2: r++, c--;
					break;
				case 3: c--, r--;
					break;
			}
		}
		rep2(i,2,a+2) {
			rep2(j,2,a+2) {
				cout << (b[i][j] ? "#": " ");
			}
			cout << endl;
		}
	}
	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>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
bool isOk(int i, int r, int c, bool b[104][104]) {
	if(i%2==0) {
		if(b[r][c-1]==0&&b[r][c+1]==0) {
			if(i==0?b[r-1][c]==0:b[r+1][c]==0) return true;
		}
	} else {
		if(b[r-1][c]==0&&b[r+1][c]==0) {
			if(i==1?b[r][c+1]==0:b[r][c-1]==0) return true;
		}
	}
	return false;
}
int main() {
	int n, a;
	cin >> n;
	bool f = 0;
	rep(i,n) {
		if(f) cout << endl;
		f = 1;
		cin >> a;
		bool b[100+4][100+4] = {};
		rep(i,a+4) {
			b[i][0] = 1;
			b[i][a+3] = 1;
			b[0][i] = 1;
			b[a+3][i] = 1;
		}
		int r = a+1, c = 2, cnt = 0;
		while(1) {
			if(!isOk(cnt, r, c, b)) break;
			while(isOk(cnt, r, c, b)) {
				b[r][c] = 1;
				switch(cnt) {
				case 0: r--;
					break;
				case 1: c++;
					break;
				case 2: r++;
					break;
				case 3: c--;
					break;
				}
			}
			cnt = (cnt+1) % 4;
			switch(cnt) {
				case 0: r--, c++;
					break;
				case 1: c++, r++;
					break;
				case 2: r++, c--;
					break;
				case 3: c--, r--;
					break;
			}
		}
		rep2(i,2,a+2) {
			rep2(j,2,a+2) {
				cout << (b[i][j] ? "#": " ");
			}
			cout << endl;
		}
	}
	return 0;
}
```