#include <iostream>
using namespace std;

int main()
{
	int d;

	while( cin >> d ){
		for( int i = 0; i < d; ++i ){
			if( i != 0 ) cout << endl;
			int n;
			cin >> n;

			int size = n + 4;
			char* map = new char[ size * size ]();
			for( int j = 0; j < size; ++j ){
				for( int k = 0; k < size; ++k ){
					map[ j * size + k ] = ' ';
				}
			}
			for( int j = 0; j < size; ++j ){
				map[ j ] = map[ ( size - 1 ) * size + j ] = map[ size * j ] = map[ ( j + 1 ) * size - 1 ] = '#';
			}
			for( int j = 2; j < size - 2; ++j ){
				map[ j * size + 2 ] = '#';
			}
			int x = 2, y = 2;
			int dir = 1;
			int dirCount = 0;
			int straightCount = 0;
			while( dirCount < 2 ){
				map[ y * size + x ] = '#';
				++straightCount;
				int nx, ny;
				switch( dir ){
					case 0: nx = x; ny = y - 2; break;
					case 1: nx = x + 2; ny = y; break;
					case 2: nx = x; ny = y + 2; break;
					case 3: nx = x - 2; ny = y; break;
				}
				if( map[ ny * size + nx ] == '#' ){
					if( straightCount < 3 ){
						break;
					}
					dir = ( dir + 1 ) % 4;
					++dirCount;
					straightCount = 0;
					continue;
				}else{
					dirCount = 0;
				}
				switch( dir ){
					case 0: y -= 1; break;
					case 1: x += 1; break;
					case 2: y += 1; break;
					case 3: x -= 1; break;
				}
			}

			for( int p = 2; p < size - 2; ++p ){
				for( int q = 2; q < size - 2; ++q ){
					cout << map[ p * size + q ];
				}
				cout << endl;
			}

			delete[] map;
		}
	}

	return 0;
}
### Prompt

Please formulate 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
#include <iostream>
using namespace std;

int main()
{
	int d;

	while( cin >> d ){
		for( int i = 0; i < d; ++i ){
			if( i != 0 ) cout << endl;
			int n;
			cin >> n;

			int size = n + 4;
			char* map = new char[ size * size ]();
			for( int j = 0; j < size; ++j ){
				for( int k = 0; k < size; ++k ){
					map[ j * size + k ] = ' ';
				}
			}
			for( int j = 0; j < size; ++j ){
				map[ j ] = map[ ( size - 1 ) * size + j ] = map[ size * j ] = map[ ( j + 1 ) * size - 1 ] = '#';
			}
			for( int j = 2; j < size - 2; ++j ){
				map[ j * size + 2 ] = '#';
			}
			int x = 2, y = 2;
			int dir = 1;
			int dirCount = 0;
			int straightCount = 0;
			while( dirCount < 2 ){
				map[ y * size + x ] = '#';
				++straightCount;
				int nx, ny;
				switch( dir ){
					case 0: nx = x; ny = y - 2; break;
					case 1: nx = x + 2; ny = y; break;
					case 2: nx = x; ny = y + 2; break;
					case 3: nx = x - 2; ny = y; break;
				}
				if( map[ ny * size + nx ] == '#' ){
					if( straightCount < 3 ){
						break;
					}
					dir = ( dir + 1 ) % 4;
					++dirCount;
					straightCount = 0;
					continue;
				}else{
					dirCount = 0;
				}
				switch( dir ){
					case 0: y -= 1; break;
					case 1: x += 1; break;
					case 2: y += 1; break;
					case 3: x -= 1; break;
				}
			}

			for( int p = 2; p < size - 2; ++p ){
				for( int q = 2; q < size - 2; ++q ){
					cout << map[ p * size + q ];
				}
				cout << endl;
			}

			delete[] map;
		}
	}

	return 0;
}
```