#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;

typedef complex<int> P;
int n;

bool Outside(P &p) {
return p.real() < 0 || p.real() >= n || p.imag() < 0 || p.imag() >= n; 
}

bool isWall(vector<string>& v,P &p){
	if(Outside(p)) return false;
	return v[p.imag()][p.real()] == '#';
}

int main(){
	int t; cin>>t;
	while(t--){
		cin>>n;
		vector<string> v(n,string(n,' '));

		P current(0,n-1),e(0,1);
		P d(0,-1);
		if(n == 1){
			v[0][0] = '#';
		} else{
			while(true){
				P next = current + d;
				if(isWall(v,next)) break;
				v[current.imag()][current.real()] = '#';
				bool ok = !Outside(next);
				if(ok){
					FOR(i,4){
						d *= e;
						P ne = next + d;
						if(ne == current) continue;
						if(isWall(v,ne))ok = false;
					}
				}

				if(!ok){
					d *= e;
				} else {
					current = next;
				}
			}
		}
		FOR(i,n) cout << v[i] << endl;

		if(t!=0)puts("");
	}

	return 0;
}
### Prompt

Develop a solution in cpp to the problem described below:

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
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;

typedef complex<int> P;
int n;

bool Outside(P &p) {
return p.real() < 0 || p.real() >= n || p.imag() < 0 || p.imag() >= n; 
}

bool isWall(vector<string>& v,P &p){
	if(Outside(p)) return false;
	return v[p.imag()][p.real()] == '#';
}

int main(){
	int t; cin>>t;
	while(t--){
		cin>>n;
		vector<string> v(n,string(n,' '));

		P current(0,n-1),e(0,1);
		P d(0,-1);
		if(n == 1){
			v[0][0] = '#';
		} else{
			while(true){
				P next = current + d;
				if(isWall(v,next)) break;
				v[current.imag()][current.real()] = '#';
				bool ok = !Outside(next);
				if(ok){
					FOR(i,4){
						d *= e;
						P ne = next + d;
						if(ne == current) continue;
						if(isWall(v,ne))ok = false;
					}
				}

				if(!ok){
					d *= e;
				} else {
					current = next;
				}
			}
		}
		FOR(i,n) cout << v[i] << endl;

		if(t!=0)puts("");
	}

	return 0;
}
```