#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;
typedef vector< vector < char > > Mat;

int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

void AOJ0141(bool newline)
{
	int n;
	cin >> n;

	if (newline) cout << endl;

	if (n == 1) {
		cout << "#" << endl;
		return;
	}
	if (n == 2) {
		cout << "##" << endl;
		cout << "# " << endl;
		return;
	}

	vector<int> steps;

	steps.push_back(n - 1);
	for (int i = n - 1; i > 0; i -= 2) {
		steps.push_back(i);
		steps.push_back(i);
	}
	if (n % 2 == 0) {
		steps.pop_back();
	}

	Mat spiral(n);
	REP(i, n) spiral[i] = vector<char>(n, ' ');
	int x = 0;
	int y = n - 1;

	spiral[y][x] = '#';

	REP(i, steps.size()) {
		REP(s, steps[i]) {
			x += dx[i % 4];
			y += dy[i % 4];
			spiral[y][x] = '#';
		}
	}

	REP(i, n) {
		REP(j, n) {
			cout << spiral[i][j];
		}
		cout << endl;
	}

	return;
}

int main()
{
	int d;
	cin >> d;

	bool newline = false;
	REP(i, d) {
		AOJ0141(newline);
		newline = true;
	}

	return 0;
}
### Prompt

Your challenge is to write 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
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;
typedef vector< vector < char > > Mat;

int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

void AOJ0141(bool newline)
{
	int n;
	cin >> n;

	if (newline) cout << endl;

	if (n == 1) {
		cout << "#" << endl;
		return;
	}
	if (n == 2) {
		cout << "##" << endl;
		cout << "# " << endl;
		return;
	}

	vector<int> steps;

	steps.push_back(n - 1);
	for (int i = n - 1; i > 0; i -= 2) {
		steps.push_back(i);
		steps.push_back(i);
	}
	if (n % 2 == 0) {
		steps.pop_back();
	}

	Mat spiral(n);
	REP(i, n) spiral[i] = vector<char>(n, ' ');
	int x = 0;
	int y = n - 1;

	spiral[y][x] = '#';

	REP(i, steps.size()) {
		REP(s, steps[i]) {
			x += dx[i % 4];
			y += dy[i % 4];
			spiral[y][x] = '#';
		}
	}

	REP(i, n) {
		REP(j, n) {
			cout << spiral[i][j];
		}
		cout << endl;
	}

	return;
}

int main()
{
	int d;
	cin >> d;

	bool newline = false;
	REP(i, d) {
		AOJ0141(newline);
		newline = true;
	}

	return 0;
}
```