#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int d, n;
char field[110][110];

int main(){
	cin >> d;
	while (d--){
		REP(i, 110)REP(j, 110)field[i][j] = ' ';
		cin >> n;
		REP(i, n)field[i][0] = '#';
		int sx = 0, sy = 0;
		int w = n - 1;
		bool f = 0;
		while (w >= 2){
			if (f == 0){
				REP(i, w){
					sx++;
					field[sy][sx] = '#';
				}
				REP(i, w){
					sy++;
					field[sy][sx] = '#';
				}
				w -= 2;
				f = 1;
			}
			else{
				REP(i, w){
					sx--;
					field[sy][sx] = '#';
				}
				REP(i, w){
					sy--;
					field[sy][sx] = '#';
				}
				w -= 2;
				f = 0;
			}
		}
		if (w == 1){
			if (f == 0)field[sy][sx + 1] = '#';
			else field[sy][sx - 1] = '#';
		}
		REP(i, n){
			REP(j, n){
				cout << field[i][j];
			}
			cout << endl;
		}
		if (d > 0)cout << endl;
	}
}
### Prompt

Construct a CPP code solution to the problem outlined:

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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int d, n;
char field[110][110];

int main(){
	cin >> d;
	while (d--){
		REP(i, 110)REP(j, 110)field[i][j] = ' ';
		cin >> n;
		REP(i, n)field[i][0] = '#';
		int sx = 0, sy = 0;
		int w = n - 1;
		bool f = 0;
		while (w >= 2){
			if (f == 0){
				REP(i, w){
					sx++;
					field[sy][sx] = '#';
				}
				REP(i, w){
					sy++;
					field[sy][sx] = '#';
				}
				w -= 2;
				f = 1;
			}
			else{
				REP(i, w){
					sx--;
					field[sy][sx] = '#';
				}
				REP(i, w){
					sy--;
					field[sy][sx] = '#';
				}
				w -= 2;
				f = 0;
			}
		}
		if (w == 1){
			if (f == 0)field[sy][sx + 1] = '#';
			else field[sy][sx - 1] = '#';
		}
		REP(i, n){
			REP(j, n){
				cout << field[i][j];
			}
			cout << endl;
		}
		if (d > 0)cout << endl;
	}
}
```