#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
char field[200][200];

int main(){
	int n, d;
	cin >> d;
	rep(t, d){
		if(t != 0) cout << endl;
		cin >> n;
		if(n == 2){
			cout << "##\n# \n";
			continue;
		}
		fill(&field[0][0], &field[199][199] + 1, '#');
		rep(i, n + 2){
			rep(j, n + 2) field[i+1][j+1] = ' ';
		}
		int x = 2;
		int y = 2 + n - 1;
		int cnt = 0;
		int dire = 0;
		while(true){
			cnt = 0;
			while(field[y + 2 * dy[dire]][x + 2 * dx[dire]] != '#'){
				cnt++;
				field[y][x] = '#';
				y += dy[dire];
				x += dx[dire];
			}
			field[y][x] = '#';
			if(cnt < 2) break;
			dire = (dire + 1) % 4;
		}
		rep(i, n){
			rep(j, n) cout << field[i+2][j+2];
			cout << endl;
		}
	}
	return 0;
}
### Prompt

Please provide a CPP coded solution 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 <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
char field[200][200];

int main(){
	int n, d;
	cin >> d;
	rep(t, d){
		if(t != 0) cout << endl;
		cin >> n;
		if(n == 2){
			cout << "##\n# \n";
			continue;
		}
		fill(&field[0][0], &field[199][199] + 1, '#');
		rep(i, n + 2){
			rep(j, n + 2) field[i+1][j+1] = ' ';
		}
		int x = 2;
		int y = 2 + n - 1;
		int cnt = 0;
		int dire = 0;
		while(true){
			cnt = 0;
			while(field[y + 2 * dy[dire]][x + 2 * dx[dire]] != '#'){
				cnt++;
				field[y][x] = '#';
				y += dy[dire];
				x += dx[dire];
			}
			field[y][x] = '#';
			if(cnt < 2) break;
			dire = (dire + 1) % 4;
		}
		rep(i, n){
			rep(j, n) cout << field[i+2][j+2];
			cout << endl;
		}
	}
	return 0;
}
```