#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
	char da[102][102];
	int d,n,i,j,x,y,c,f=0,dx,dy,dm;
	cin >> d; 
	for (;d>0;d--) {
		cin >> n;
		for (i=0;i<n+1;i++) for (j=0;j<n+1;j++) da[i][j]=' ';
		for (i=0;i<n+2;i++) {da[i][n+1]='#'; da[n+1][i]='#';}
		dx=0; dy=-1; x=0; y=n-1; c=0;
		while(true) {
			da[y][x]='#';
			if (da[y+dy*2][x+dx*2]=='#' || y+dy==-1) {
				c++; dm=dx; dx=-dy; dy=dm;
				if (c==n) break;
			}
			x+=dx; y+=dy;
		}
		if (f==1) cout << endl; else f=1; 
		for (i=0;i<n;i++) {
			for (j=0;j<n;j++) cout << da[i][j];
			cout << endl;
		}
	}
	return 0;
}
### Prompt

In Cpp, your task is to solve 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 <stdio.h>
#include <string>

using namespace std;

int main() {
	char da[102][102];
	int d,n,i,j,x,y,c,f=0,dx,dy,dm;
	cin >> d; 
	for (;d>0;d--) {
		cin >> n;
		for (i=0;i<n+1;i++) for (j=0;j<n+1;j++) da[i][j]=' ';
		for (i=0;i<n+2;i++) {da[i][n+1]='#'; da[n+1][i]='#';}
		dx=0; dy=-1; x=0; y=n-1; c=0;
		while(true) {
			da[y][x]='#';
			if (da[y+dy*2][x+dx*2]=='#' || y+dy==-1) {
				c++; dm=dx; dx=-dy; dy=dm;
				if (c==n) break;
			}
			x+=dx; y+=dy;
		}
		if (f==1) cout << endl; else f=1; 
		for (i=0;i<n;i++) {
			for (j=0;j<n;j++) cout << da[i][j];
			cout << endl;
		}
	}
	return 0;
}
```